Spaces:
Sleeping
Sleeping
Tim Seufert
commited on
Commit
·
8af3f9e
1
Parent(s):
4b1eda6
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,
|
@@ -37,26 +37,23 @@ def respond(message, chat_history):
|
|
37 |
|
38 |
# Update chat history
|
39 |
chat_history.append((message, response))
|
40 |
-
return chat_history
|
41 |
except Exception as e:
|
42 |
chat_history.append((message, f"Error: {str(e)}"))
|
43 |
-
return chat_history
|
44 |
|
45 |
# Create Gradio interface
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
50 |
|
51 |
-
|
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()
|
|
|
25 |
try:
|
26 |
# Generate response using Cohere chat API
|
27 |
response = co.chat(
|
28 |
+
model='command-xlarge-nightly', # Ensure the correct model ID is used
|
29 |
query=f"{prompt} '{message_content}'",
|
30 |
temperature=0.3,
|
31 |
k=0,
|
|
|
37 |
|
38 |
# Update chat history
|
39 |
chat_history.append((message, response))
|
40 |
+
return chat_history
|
41 |
except Exception as e:
|
42 |
chat_history.append((message, f"Error: {str(e)}"))
|
43 |
+
return chat_history
|
44 |
|
45 |
# Create Gradio interface
|
46 |
+
demo = gr.ChatInterface(
|
47 |
+
fn=respond,
|
48 |
+
type="messages",
|
49 |
+
flagging_mode="manual",
|
50 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
51 |
+
save_history=True,
|
52 |
+
)
|
53 |
|
54 |
+
if __name__ == "__main__":
|
|
|
|
|
|
|
55 |
demo.launch(
|
56 |
share=True,
|
57 |
server_name="0.0.0.0",
|
58 |
allowed_paths=["*"]
|
59 |
+
)
|
|
|
|
|
|