diff --git a/__pycache__/apicalls.cpython-311.pyc b/__pycache__/apicalls.cpython-311.pyc new file mode 100644 index 0000000..9baf873 Binary files /dev/null and b/__pycache__/apicalls.cpython-311.pyc differ diff --git a/__pycache__/config.cpython-311.pyc b/__pycache__/config.cpython-311.pyc index 5b517fc..0874029 100644 Binary files a/__pycache__/config.cpython-311.pyc and b/__pycache__/config.cpython-311.pyc differ diff --git a/application/__pycache__/__init__.cpython-311.pyc b/application/__pycache__/__init__.cpython-311.pyc index 85e8119..ae68705 100644 Binary files a/application/__pycache__/__init__.cpython-311.pyc and b/application/__pycache__/__init__.cpython-311.pyc differ diff --git a/application/__pycache__/routes.cpython-310.pyc b/application/__pycache__/routes.cpython-310.pyc index ea6d952..54e660a 100644 Binary files a/application/__pycache__/routes.cpython-310.pyc and b/application/__pycache__/routes.cpython-310.pyc differ diff --git a/application/__pycache__/routes.cpython-311.pyc b/application/__pycache__/routes.cpython-311.pyc index 02ffc15..232b6a7 100644 Binary files a/application/__pycache__/routes.cpython-311.pyc and b/application/__pycache__/routes.cpython-311.pyc differ diff --git a/application/routes.py b/application/routes.py index 0c07e61..cba0832 100644 --- a/application/routes.py +++ b/application/routes.py @@ -4,9 +4,11 @@ Flask app that uses gpt4all to generate random song writing prompt. import os import string import random +import requests from flask import ( render_template, session, + request, ) from gpt4all import GPT4All from datetime import datetime, timezone, timedelta @@ -17,11 +19,11 @@ app.config.update(SECRET_KEY=os.urandom(24)) app.permanent_session_lifetime = timedelta(minutes=30) MODEL = GPT4All( - model_name="orca-mini-3b-gguf2-q4_0.gguf", + model_name="gpt4all-falcon-q4_0.gguf", model_path=(Path.home() / ".cache" / "gpt4all"), - allow_download=False, + allow_download=True, ) -TIME_SIGNATURES=["2/4", "3/4", "4/4", "2/2", "6/8", "9/8", "12/8"] +TIME_SIGNATURES = ["2/4", "3/4", "4/4", "2/2", "6/8", "9/8", "12/8"] # Need to decide between manually entering this list or using ascii_letters, below KEYS = ["A", "B", "C", "D", "E", "F", "G"] @@ -40,21 +42,40 @@ def main_prompt(): """ return render_template("index.html", title="Home") + +@app.route("/all", methods=["GET", "POST"]) +def prompt_all(): + WORD_PROMPT = str(requests.get("https://random-word-api.herokuapp.com/word").text)[ + 2:-2 + ] + if request.method == "POST": + message = "Results are here" + session["output_key"] = random.choice(KEYS) + random.choice(SIGN) + session["output_signature"] = random.choice(TIME_SIGNATURES) + response = MODEL.generate(f"A single sentence about {WORD_PROMPT}", temp=0).splitlines().pop(0) + numresp = len(response)- 1 + if numresp <= 1: + session["output_theme"] = str(response) + randresp = random.randrange(0, numresp) + session["output_theme"] = response + return render_template("single-button.html", title="Results", message=message) + return render_template("single-button.html", title="Single Option") + + @app.route("/") def prompt_instrument(): pass + @app.route("/") def prompt_key(): pass + @app.route("/") def prompt_timesig(): pass -@app.route("/") -def prompt_all(): - pass @app.route("/") def prompt_influence(): diff --git a/application/static/styles.css b/application/static/styles.css index 5f659b6..7297359 100644 --- a/application/static/styles.css +++ b/application/static/styles.css @@ -47,6 +47,9 @@ html { display: flex; justify-content: center; } +header { + height: 10%; +} .prompt-button { background-color: rgba(255, 255, 255, 0.5); @@ -64,3 +67,9 @@ html { .prompt { padding: 5px; } + +.results-container { + display: inline-block; + width: 60%; + text-align: center; +} diff --git a/application/templates/modal_results.html b/application/templates/modal_results.html new file mode 100644 index 0000000..c75f881 --- /dev/null +++ b/application/templates/modal_results.html @@ -0,0 +1,133 @@ + + +
+ + + diff --git a/application/templates/results.html b/application/templates/results.html new file mode 100644 index 0000000..0568e15 --- /dev/null +++ b/application/templates/results.html @@ -0,0 +1,18 @@ + +{% include 'head.html' %} +{% include 'header.html' %} +{% block content %} +