diff --git a/__pycache__/apicalls.cpython-310.pyc b/__pycache__/apicalls.cpython-310.pyc index 2ef8c5b..770f67a 100644 Binary files a/__pycache__/apicalls.cpython-310.pyc and b/__pycache__/apicalls.cpython-310.pyc differ diff --git a/__pycache__/config.cpython-310.pyc b/__pycache__/config.cpython-310.pyc index ffd1d48..e0f91f7 100644 Binary files a/__pycache__/config.cpython-310.pyc and b/__pycache__/config.cpython-310.pyc differ diff --git a/application/__pycache__/__init__.cpython-310.pyc b/application/__pycache__/__init__.cpython-310.pyc index 37c43bb..4e5e0f0 100644 Binary files a/application/__pycache__/__init__.cpython-310.pyc and b/application/__pycache__/__init__.cpython-310.pyc differ diff --git a/application/__pycache__/routes.cpython-310.pyc b/application/__pycache__/routes.cpython-310.pyc index 54e660a..1088fbd 100644 Binary files a/application/__pycache__/routes.cpython-310.pyc and b/application/__pycache__/routes.cpython-310.pyc differ diff --git a/application/routes.py b/application/routes.py index cba0832..50aa3a2 100644 --- a/application/routes.py +++ b/application/routes.py @@ -48,16 +48,23 @@ def prompt_all(): WORD_PROMPT = str(requests.get("https://random-word-api.herokuapp.com/word").text)[ 2:-2 ] + SYSTEM_TEMPLATE = 'A single sentence based on a word.' + PROMPT_TEMPLATE = '### Instruction: {0} \n### Response: ' 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 + session["word_prompt"] = WORD_PROMPT + with MODEL.chat_session(SYSTEM_TEMPLATE, PROMPT_TEMPLATE): + response = MODEL.generate(f"A single sentence about {WORD_PROMPT}.", temp=0.7) + session["output_theme"] = str(response.splitlines()[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") diff --git a/application/static/styles.css b/application/static/styles.css index 7297359..c2c8a77 100644 --- a/application/static/styles.css +++ b/application/static/styles.css @@ -73,3 +73,104 @@ header { width: 60%; text-align: center; } + +/* MODAL POPUP */ +.first-time-user-popup { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1000; + display: flex; + padding: 1em; + background-color: rgba(0, 0, 0, 0.75); + transition: 0.25s ease-out; +} +.first-time-user-popup.is-active { + visibility: visible; + opacity: 1; + pointer-events: auto; +} + +.first-time-user-popup-container { + width: 100%; + max-width: 600px; + margin: auto; + transform: translateY(-1em) scale(0.95); + background-color: white; + transition: transform 0.25s ease-out; + border-radius: 8px; +} + +.first-time-user-popup.is-active .first-time-user-popup-container { + transform: translateY(0) scale(1); +} + +.modal-headline { + font-size: 20px; + line-height: normal; + font-weight: 500; + margin-bottom: 32px; + text-align: center; + color: #F7492D; +} + +.modal-links { + display: block; +} + +.modal-x-out { + float: left; + border: none; + background: transparent; +} + +.modal-links a { + border: 2px solid #3c228a; + background: #F7492D; + padding: 8px 16px; + text-align: center; + width: calc(50% - 8px); + margin: 0 8px; + border-radius: 30px; + color: #fff; + text-decoration: none; + font-weight: 700; + transition: all 0.2s; +} + +.modal-links a.secondary { + background: transparent; + color: #3c228a; +} + +.modal-links a:hover { + border: 2px solid #13014a; + background: #13014a; +} + +.modal-links a.secondary:hover { + border: 2px solid #13014a; + background: #ebe8f3; + color: #13014a; +} + +.first-time-user-popup-content { + padding: 32px 16px; +} + +@media (min-width: 768px) { + .first-time-user-popup-content { + padding: 32px; + } + + .modal-headline { + font-size: 24px; + } + + .modal-links a { + min-height: 40px; + line-height: 40px; + } +} diff --git a/application/templates/modal_results.html b/application/templates/modal_results.html index 32c30da..4fdc1b5 100644 --- a/application/templates/modal_results.html +++ b/application/templates/modal_results.html @@ -7,115 +7,24 @@ aria-hidden="true">
+
- - - diff --git a/gpt4all_tst.py b/gpt4all_tst.py index f2ac44c..4581222 100644 --- a/gpt4all_tst.py +++ b/gpt4all_tst.py @@ -2,9 +2,16 @@ from gpt4all import GPT4All import requests from pathlib import Path -MODEL = GPT4All(model_name="gpt4all-falcon-q4_0.gguf", model_path=(Path.home() / ".cache" / "gpt4all"), allow_download=True) +MODEL = GPT4All( + model_name="gpt4all-falcon-q4_0.gguf", + model_path=(Path.home() / ".cache" / "gpt4all"), + allow_download=True, +) WORD_PROMPT = str(requests.get("https://random-word-api.herokuapp.com/word").text)[2:-2] -response = MODEL.generate(f"The theme is {WORD_PROMPT} and this song is about", temp=1) -print(WORD_PROMPT) -resp = response.splitlines().pop(0) -print(resp) +SYSTEM_TEMPLATE = 'A single sentence based on a word.' +PROMPT_TEMPLATE = '### Instruction: {0} \n### Response: ' +with MODEL.chat_session(SYSTEM_TEMPLATE, PROMPT_TEMPLATE): + response = MODEL.generate(f"A single sentence about {WORD_PROMPT}.", temp=0.7) + print(WORD_PROMPT) + resp = str(response.splitlines()[0]) + print(resp)