Spaces:
Sleeping
Sleeping
Tim Seufert
commited on
Commit
·
4b1eda6
1
Parent(s):
bdb8997
update interface beta test2
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def respond(message, chat_history):
|
|
25 |
try:
|
26 |
# Generate response using Cohere chat API
|
27 |
response = co.chat(
|
28 |
-
model='command-
|
29 |
query=f"{prompt} '{message_content}'",
|
30 |
temperature=0.3,
|
31 |
k=0,
|
@@ -39,20 +39,24 @@ def respond(message, chat_history):
|
|
39 |
chat_history.append((message, response))
|
40 |
return chat_history, chat_history
|
41 |
except Exception as e:
|
42 |
-
|
|
|
43 |
|
44 |
# Create Gradio interface
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
50 |
-
save_history=True,
|
51 |
-
)
|
52 |
|
53 |
-
|
|
|
|
|
|
|
54 |
demo.launch(
|
55 |
share=True,
|
56 |
server_name="0.0.0.0",
|
57 |
allowed_paths=["*"]
|
58 |
-
)
|
|
|
|
|
|
|
|
25 |
try:
|
26 |
# Generate response using Cohere chat API
|
27 |
response = co.chat(
|
28 |
+
model='command-r-plus-08_2024', # Ensure the correct model ID is used
|
29 |
query=f"{prompt} '{message_content}'",
|
30 |
temperature=0.3,
|
31 |
k=0,
|
|
|
39 |
chat_history.append((message, response))
|
40 |
return chat_history, chat_history
|
41 |
except Exception as e:
|
42 |
+
chat_history.append((message, f"Error: {str(e)}"))
|
43 |
+
return chat_history, chat_history
|
44 |
|
45 |
# Create Gradio interface
|
46 |
+
with gr.Blocks() as demo:
|
47 |
+
chatbot = gr.Chatbot()
|
48 |
+
msg = gr.Textbox()
|
49 |
+
clear = gr.ClearButton([msg, chatbot])
|
|
|
|
|
|
|
50 |
|
51 |
+
# Set up message submission
|
52 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
53 |
+
|
54 |
+
# Launch the demo
|
55 |
demo.launch(
|
56 |
share=True,
|
57 |
server_name="0.0.0.0",
|
58 |
allowed_paths=["*"]
|
59 |
+
)
|
60 |
+
|
61 |
+
if __name__ == "__main__":
|
62 |
+
demo.launch()
|