Skip to content

Commit

Permalink
Merge pull request #3 from gavinmorrisseau/Flask
Browse files Browse the repository at this point in the history
Add Flask
  • Loading branch information
gavinmorrisseau committed Dec 11, 2023
2 parents 1882375 + 66846a4 commit b9718d1
Show file tree
Hide file tree
Showing 148 changed files with 31,949 additions and 75 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.cache
playground.py
.gitignore
.DS_Store
15 changes: 15 additions & 0 deletions FlaskApp/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from flask import Flask, render_template, request

app = Flask(__name__)

@app.route("/")
def index():
return render_template("index.html")
@app.route("/result", methods=["POST", "GET"])
def result():
output = request.form.to_dict()
question = output["question"]
return render_template("index.html", question=question)

if __name__ == "__main__":
app.run(debug=True, port=5001)
File renamed without changes.
2 changes: 1 addition & 1 deletion src/gpt_for_web.py → FlaskApp/src/gpt_for_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def wait_on_run(run, thread):
)

thread = client.beta.threads.create()
PROMPT = input("[*]: ")
PROMPT = input("[*]: ").lower().strip() or "Give me a list of 5 random great songs"
ASSISTANT_ID = "asst_Z8EJORrugfSAMUgxKXWNAaXw"

message = client.beta.threads.messages.create(
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Empty file added FlaskApp/static/js/index.js
Empty file.
58 changes: 27 additions & 31 deletions index.css → FlaskApp/static/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ html, body {
body {
font-size: 16px;
font-family: Arial, sans-serif;
background-color: #FAF9F6;
}

/* Add styles for the header */
header {
background-color: #333;
color: #fff;
background-color: #555555;
color: #FAF9F6;
padding: 20px;
}

Expand All @@ -51,70 +52,65 @@ form {
margin-bottom: 20px;
}

textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}

#header * {
background-color: #fff;
background-color: #FAF9F6;
color: #141214;
text-align: center;
}

#headertext {
font-size: 2.5rem;
font-weight: 800;
margin-top: 16rem;
margin-top: 8rem;
color: #555555;
}

#headerlogo {
position: relative;
display: inline;
margin-left: auto;
margin-right: auto;
width: 6rem;
height: 6rem;
top: 1.6rem;
}

#subtext {
position: relative;
font-size: 1rem;
font-weight: 400;
margin-bottom: 4rem;
margin-bottom: 6rem;
color: #555555;
}

.chat * {
.chatbox * {
text-align: center;
}

input {
width: 20%;
height: 1.7rem;
width: 27%;
height: 2.05rem;
text-align: left;
border-radius: 4px;
background-color: #555555;
color:#FAF9F6
}

input::placeholder {
text-align: center;

text-align: center;
background-color: #555555;
color: #FAF9F6;
}

.button {
padding: 10px 20px;
text-align: left;
color: #fff;
background-color: #515151;
border: none;
border-radius: 4px;
color: #FAF9F6;
background-color: #555555;
}

.button:hover {
background-color:#000;
color: #fff
}

#headerlogo {
position: relative;
display: inline;
margin-left: auto;
margin-right: auto;
width: 6rem;
height: 6rem;
top: 1.6rem;
}

33 changes: 33 additions & 0 deletions FlaskApp/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="../static/assets/images/favicon.svg">
<link rel="icon" type="image/png" href="../static/assets/images/favicon.png">
<!-- Theming -->
<meta name="theme-color" content="#FAF9F6">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Title and Stylesheet -->
<title>aijukebox.net</title>
<link rel="stylesheet" href="/static/styles/index.css" />
</head>
<body>
<div class="noselect" id="header">
<h1 id="headertext">hey, boss<img id="headerlogo" src="../static/assets/images/OriginalLogoTransparent.png" alt="logo"></h1>
<p id="subtext">what's the mood today?</p>
</div>
<div class="chatbox">
<div class="chatbox__input">
<form action="/result" method="POST">
<input type="text" name="question" id="question" placeholder="type a message ...">
<button class="button">send</button>
</form>
{% if question%}
<p>{{question}}</p>
{% endif %}
</div>
</div>
<script src="static/js/index.js"></script>
</body>
</html>
Binary file added __pycache__/app.cpython-310.pyc
Binary file not shown.
30 changes: 0 additions & 30 deletions index.html

This file was deleted.

7 changes: 0 additions & 7 deletions index.js

This file was deleted.

11 changes: 9 additions & 2 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b9718d1

Please sign in to comment.