-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from gavinmorrisseau/secondary
Alpha 1.0.0
- Loading branch information
Showing
23 changed files
with
883 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.cache | ||
playground.py | ||
.gitignore | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"open-in-browser.default": "fde" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# AI-music-recommendation | ||
# AI-music-recommendation | ||
> Music Recommendations Python app utilziing Spotify and OpenAI API. |
File renamed without changes
File renamed without changes
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* FILEPATH: /workspaces/AI-music-recommendation/web/index.css */ | ||
|
||
|
||
/* Enable noselect for major browsers */ | ||
.noselect { | ||
-webkit-touch-callout: none; /* iOS Safari */ | ||
-webkit-user-select: none; /* Safari */ | ||
-khtml-user-select: none; /* Konqueror HTML */ | ||
-moz-user-select: none; /* Old versions of Firefox */ | ||
-ms-user-select: none; /* Internet Explorer/Edge */ | ||
user-select: none; /* Non-prefixed version, currently | ||
supported by Chrome, Edge, Opera and Firefox */ | ||
} | ||
|
||
/* Reset default browser styles */ | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
/* Set a base font size and family */ | ||
body { | ||
font-size: 16px; | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
/* Add styles for the header */ | ||
header { | ||
background-color: #333; | ||
color: #fff; | ||
padding: 20px; | ||
} | ||
|
||
/* Add styles for the main content */ | ||
main { | ||
padding: 20px; | ||
} | ||
|
||
/* Add styles for links */ | ||
a { | ||
color: #007bff; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
/* Add styles for forms */ | ||
form { | ||
margin-bottom: 20px; | ||
} | ||
|
||
textarea { | ||
width: 100%; | ||
padding: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
} | ||
|
||
#header * { | ||
background-color: #fff; | ||
color: #141214; | ||
text-align: center; | ||
} | ||
|
||
#headertext { | ||
font-size: 2.5rem; | ||
font-weight: 800; | ||
margin-top: 16rem; | ||
color: #555555; | ||
} | ||
|
||
#subtext { | ||
position: relative; | ||
font-size: 1rem; | ||
font-weight: 400; | ||
margin-bottom: 4rem; | ||
color: #555555; | ||
} | ||
|
||
.chat * { | ||
text-align: center; | ||
} | ||
|
||
input { | ||
width: 20%; | ||
height: 1.7rem; | ||
text-align: left; | ||
} | ||
|
||
input::placeholder { | ||
text-align: center; | ||
|
||
} | ||
|
||
.button { | ||
padding: 10px 20px; | ||
text-align: left; | ||
color: #fff; | ||
background-color: #515151; | ||
border: none; | ||
border-radius: 4px; | ||
} | ||
|
||
.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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<link rel="icon" type="image/svg+xml" href="../assets/images/favicon.svg"> | ||
<link rel="icon" type="image/png" href="../assets/images/favicon.png"> | ||
<meta name="theme-color" content="#fdf7f2"> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<!-- Add to Source Later--> | ||
<script type="module" src="https://md-block.verou.me/md-block.js"></script> | ||
<title>aijukebox.net</title> | ||
<link rel="stylesheet" href="index.css"> | ||
</head> | ||
<body> | ||
<div class="noselect" id="header"> | ||
<h1 id="headertext">hey, boss<img id="headerlogo" src="/assets/images/OriginalLogoTransparent.png" alt="logo"></h1> | ||
<p id="subtext">what's the mood today?</p> | ||
</div> | ||
<div= class="chat"> | ||
<div class="chatbox"> | ||
<div class="chatbox__messages"> | ||
</div> | ||
<div class="chatbox__input"> | ||
<input type="text" placeholder="type a message ..."> | ||
<button onclick="runGPT()" class="button">send</button> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function runGPT() { | ||
// Get the path to the Python script. | ||
var pythonScriptPath = "/src/GPT.py"; | ||
|
||
// Run the Python script. | ||
subprocess.run(["python", pythonScriptPath]); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import time | ||
import json | ||
import sys | ||
from openai import OpenAI | ||
|
||
# ~ Docs ~ | ||
# https://cookbook.openai.com/examples/assistants_api_overview_python | ||
# https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages | ||
|
||
def wait_on_run(run, thread): | ||
while run.status == "queued" or run.status == "in_progress": | ||
run = client.beta.threads.runs.retrieve( | ||
thread_id=thread.id, | ||
run_id=run.id, | ||
) | ||
time.sleep(0.5) | ||
return run | ||
|
||
client = OpenAI( | ||
organization='org-1VoooiSLTr711Aax6i6A5nUT', | ||
) | ||
|
||
thread = client.beta.threads.create() | ||
PROMPT = input("[*]: ") | ||
ASSISTANT_ID = "asst_Z8EJORrugfSAMUgxKXWNAaXw" | ||
|
||
message = client.beta.threads.messages.create( | ||
thread_id=thread.id, | ||
role="user", | ||
content=PROMPT, | ||
) | ||
|
||
run = client.beta.threads.runs.create( | ||
thread_id=thread.id, | ||
assistant_id=ASSISTANT_ID, | ||
) | ||
|
||
run = wait_on_run(run, thread) | ||
messages = client.beta.threads.messages.list(thread_id=thread.id) | ||
message_object = messages.data[0].content[0].text.value | ||
|
||
try: | ||
message_parsed = json.loads(message_object) | ||
except json.decoder.JSONDecodeError: | ||
print(f'FAILED: \n{message}') | ||
sys.exit() | ||
|
||
for count in range(1,6): | ||
artist = str(message_parsed[str(count)]['artist']) | ||
track = str(message_parsed[str(count)]['track']) | ||
print(f'{track} by {artist}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import time | ||
import json | ||
import sys | ||
from openai import OpenAI | ||
|
||
# ~ Docs ~ | ||
# https://cookbook.openai.com/examples/assistants_api_overview_python | ||
# https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages | ||
|
||
def wait_on_run(run, thread): | ||
while run.status == "queued" or run.status == "in_progress": | ||
run = client.beta.threads.runs.retrieve( | ||
thread_id=thread.id, | ||
run_id=run.id, | ||
) | ||
time.sleep(0.5) | ||
return run | ||
|
||
client = OpenAI( | ||
organization='org-1VoooiSLTr711Aax6i6A5nUT', | ||
) | ||
|
||
thread = client.beta.threads.create() | ||
PROMPT = input("[*]: ") | ||
ASSISTANT_ID = "asst_Z8EJORrugfSAMUgxKXWNAaXw" | ||
|
||
message = client.beta.threads.messages.create( | ||
thread_id=thread.id, | ||
role="user", | ||
content=PROMPT, | ||
) | ||
|
||
run = client.beta.threads.runs.create( | ||
thread_id=thread.id, | ||
assistant_id=ASSISTANT_ID, | ||
) | ||
|
||
run = wait_on_run(run, thread) | ||
messages = client.beta.threads.messages.list(thread_id=thread.id) | ||
message_object = messages.data[0].content[0].text.value | ||
|
||
try: | ||
message_parsed = json.loads(message_object) | ||
except json.decoder.JSONDecodeError: | ||
print(f'FAILED: \n{message}') | ||
sys.exit() | ||
|
||
for count in range(1,6): | ||
artist = str(message_parsed[str(count)]['artist']) | ||
track = str(message_parsed[str(count)]['track']) | ||
print(f'{track} by {artist}') |
File renamed without changes.