Commit
·
2638861
1
Parent(s):
d45f294
clean up, add remote sssAPI, clean up concat
Browse files- chat.py +1 -1
- gpt_calls.py +6 -1
- suno.py +10 -6
chat.py
CHANGED
@@ -20,7 +20,7 @@ History = List[Tuple[str, str]] # a type: pairs of (query, response), where quer
|
|
20 |
Messages = List[Dict[str, str]] # a type: list of messages with role and content
|
21 |
|
22 |
client_key = os.getenv("OPEN_AI_KEY")
|
23 |
-
print(client_key)
|
24 |
oai_client = OpenAI(
|
25 |
api_key=client_key,
|
26 |
)
|
|
|
20 |
Messages = List[Dict[str, str]] # a type: list of messages with role and content
|
21 |
|
22 |
client_key = os.getenv("OPEN_AI_KEY")
|
23 |
+
# print(client_key)
|
24 |
oai_client = OpenAI(
|
25 |
api_key=client_key,
|
26 |
)
|
gpt_calls.py
CHANGED
@@ -137,7 +137,12 @@ class AI_Songwriter:
|
|
137 |
instruction += "Here's an example:\n{convo}\nNow do it for this input:"
|
138 |
|
139 |
|
140 |
-
input =
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
prompt = self.alpaca_prompt.format(instruction, input, "")
|
143 |
|
|
|
137 |
instruction += "Here's an example:\n{convo}\nNow do it for this input:"
|
138 |
|
139 |
|
140 |
+
input = ""
|
141 |
+
if relevant_ideas is not None and isinstance(relevant_ideas, list):
|
142 |
+
input += f"Ideas to use: {', '.join(relevant_ideas)}\n"
|
143 |
+
if relevant_words is not None and isinstance(relevant_words, list):
|
144 |
+
input += f"Words to use: {', '.join(relevant_words)}\n"
|
145 |
+
input += f"Genre: Songwriter Pop\nEra: 2010s\nCurrent section:\n{full_incomplete_verse}\n\nLyrics:"
|
146 |
|
147 |
prompt = self.alpaca_prompt.format(instruction, input, "")
|
148 |
|
suno.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
import asyncio
|
5 |
import httpx
|
6 |
|
7 |
-
base_url = "
|
8 |
api_endpoint_submit = f"{base_url}/generate/"
|
9 |
api_endpoint_concat = f"{base_url}/generate/concat"
|
10 |
api_endpoint_info = f"{base_url}/feed/"
|
@@ -139,11 +139,15 @@ def concat_snippets(clip_id):
|
|
139 |
print("No data in response, retrying", response_data)
|
140 |
time.sleep(2)
|
141 |
continue
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
147 |
else:
|
148 |
time.sleep(8)
|
149 |
continue
|
|
|
4 |
import asyncio
|
5 |
import httpx
|
6 |
|
7 |
+
base_url = "https://sss-api-blond.vercel.app"
|
8 |
api_endpoint_submit = f"{base_url}/generate/"
|
9 |
api_endpoint_concat = f"{base_url}/generate/concat"
|
10 |
api_endpoint_info = f"{base_url}/feed/"
|
|
|
139 |
print("No data in response, retrying", response_data)
|
140 |
time.sleep(2)
|
141 |
continue
|
142 |
+
if isinstance(response_data, list):
|
143 |
+
status = response_data[0]["status"]
|
144 |
+
else:
|
145 |
+
status = response_data["status"]
|
146 |
+
|
147 |
+
if status == 'streaming':
|
148 |
+
return "Song is still streaming, please wait to request later.", None, None, []
|
149 |
+
if status == 'complete':
|
150 |
+
break
|
151 |
else:
|
152 |
time.sleep(8)
|
153 |
continue
|