Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import sseclient
|
| 4 |
-
import logging
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
def chat(prompt):
|
| 9 |
-
url = "https://wlchee-mcp-sentiment.hf.space/gradio_api/mcp/sse"
|
| 10 |
headers = {
|
| 11 |
"Accept": "text/event-stream",
|
| 12 |
"Content-Type": "application/json"
|
| 13 |
}
|
| 14 |
-
payload = {"input":
|
| 15 |
|
| 16 |
try:
|
| 17 |
# Send streaming request to MCP server
|
|
@@ -28,5 +25,4 @@ def chat(prompt):
|
|
| 28 |
yield f"Error: {e}"
|
| 29 |
|
| 30 |
# Launch Tiny Agent UI
|
| 31 |
-
gr.ChatInterface(chat, title="Sentiment Tiny Agent").launch()
|
| 32 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import sseclient
|
|
|
|
| 4 |
|
| 5 |
+
def chat(message, history):
|
| 6 |
+
url = "https://alan-mcp-sentiment.hf.space/gradio_api/mcp/sse"
|
|
|
|
|
|
|
| 7 |
headers = {
|
| 8 |
"Accept": "text/event-stream",
|
| 9 |
"Content-Type": "application/json"
|
| 10 |
}
|
| 11 |
+
payload = {"input": message}
|
| 12 |
|
| 13 |
try:
|
| 14 |
# Send streaming request to MCP server
|
|
|
|
| 25 |
yield f"Error: {e}"
|
| 26 |
|
| 27 |
# Launch Tiny Agent UI
|
| 28 |
+
gr.ChatInterface(fn=chat, title="Sentiment Tiny Agent").launch()
|
|
|