Update app.py
Browse files
app.py
CHANGED
|
@@ -74,19 +74,21 @@ def respond(message,history):
|
|
| 74 |
|
| 75 |
messages.append({"role": "user", "content": message})
|
| 76 |
|
| 77 |
-
response =
|
| 78 |
-
for message in client.chat_completion(
|
| 79 |
#max_tokens controls how many words your responses is
|
| 80 |
messages,
|
| 81 |
max_tokens = 500,
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
#temperature = 0.8, #code a decimal between 0-2
|
| 85 |
#top_p = .65 #code a decimal between 0-1
|
| 86 |
-
):
|
| 87 |
-
token = message.choices[0].delta.content
|
| 88 |
-
response += token
|
| 89 |
-
|
|
|
|
| 90 |
#print(response["choices"][0]["message"]["content"].strip())
|
| 91 |
|
| 92 |
#yield response["choices"][0]["message"]["content"].strip()
|
|
@@ -114,7 +116,7 @@ def respond(message,history):
|
|
| 114 |
|
| 115 |
#msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 116 |
#send.click(respond, [msg, chatbot], [msg, chatbot])
|
| 117 |
-
|
| 118 |
with gr.Blocks(theme='hmb/amethyst') as demo:
|
| 119 |
# Top image
|
| 120 |
gr.Image(value="wrap_it_top_image.png", show_label=False, elem_id="top-image")
|
|
|
|
| 74 |
|
| 75 |
messages.append({"role": "user", "content": message})
|
| 76 |
|
| 77 |
+
response = client.chat_completion(
|
| 78 |
+
# for message in client.chat_completion(
|
| 79 |
#max_tokens controls how many words your responses is
|
| 80 |
messages,
|
| 81 |
max_tokens = 500,
|
| 82 |
+
)
|
| 83 |
+
# stream = True,
|
| 84 |
|
| 85 |
#temperature = 0.8, #code a decimal between 0-2
|
| 86 |
#top_p = .65 #code a decimal between 0-1
|
| 87 |
+
#):
|
| 88 |
+
# token = message.choices[0].delta.content
|
| 89 |
+
# response += token
|
| 90 |
+
return response
|
| 91 |
+
#yield response
|
| 92 |
#print(response["choices"][0]["message"]["content"].strip())
|
| 93 |
|
| 94 |
#yield response["choices"][0]["message"]["content"].strip()
|
|
|
|
| 116 |
|
| 117 |
#msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 118 |
#send.click(respond, [msg, chatbot], [msg, chatbot])
|
| 119 |
+
print("The bug is in the gradio")
|
| 120 |
with gr.Blocks(theme='hmb/amethyst') as demo:
|
| 121 |
# Top image
|
| 122 |
gr.Image(value="wrap_it_top_image.png", show_label=False, elem_id="top-image")
|