Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,9 +157,11 @@ def function(Textbox, Textbox2, Textbox3):
|
|
157 |
Textbox2_edited = [x.strip() for x in Textbox2]
|
158 |
Textbox2_edited = list(Textbox2_edited)
|
159 |
Textbox2_edited.append(Textbox)
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
163 |
for i in Textbox2_edited:
|
164 |
messages.append(
|
165 |
{"role": "user", "content": i}
|
@@ -169,10 +171,9 @@ def function(Textbox, Textbox2, Textbox3):
|
|
169 |
# chat = openai.ChatCompletion.create(
|
170 |
# model="gpt-3.5-turbo", messages=messages
|
171 |
# )
|
172 |
-
|
173 |
-
post = requests.post(target2, json=messages)
|
174 |
print(post.content)
|
175 |
-
reply =
|
176 |
reply = reply.replace(" ", "%20")
|
177 |
image_array = download_image(f"https://api.placid.app/u/pydav4ibo?quote[text]={reply}")
|
178 |
messages.append({"role": "assistant", "content": reply})
|
|
|
157 |
Textbox2_edited = [x.strip() for x in Textbox2]
|
158 |
Textbox2_edited = list(Textbox2_edited)
|
159 |
Textbox2_edited.append(Textbox)
|
160 |
+
data = {
|
161 |
+
messages = [
|
162 |
+
{"role": "system", "content": content},
|
163 |
+
]
|
164 |
+
}
|
165 |
for i in Textbox2_edited:
|
166 |
messages.append(
|
167 |
{"role": "user", "content": i}
|
|
|
171 |
# chat = openai.ChatCompletion.create(
|
172 |
# model="gpt-3.5-turbo", messages=messages
|
173 |
# )
|
174 |
+
response = requests.post(target2, json=messages)
|
|
|
175 |
print(post.content)
|
176 |
+
reply = response.content.decode("utf-8")
|
177 |
reply = reply.replace(" ", "%20")
|
178 |
image_array = download_image(f"https://api.placid.app/u/pydav4ibo?quote[text]={reply}")
|
179 |
messages.append({"role": "assistant", "content": reply})
|