Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
-
import
|
| 2 |
import gradio as gr
|
| 3 |
from smolagents import Agent
|
| 4 |
from smolagents.mcp import MCPServerHTTP
|
| 5 |
from smolagents.models import HuggingFaceModel
|
| 6 |
from smolagents.providers import HuggingFaceProvider
|
| 7 |
|
|
|
|
|
|
|
| 8 |
# MCP Server SSE URL
|
| 9 |
SSE_URL = "https://oppaai-job-search-mcp-server.hf.space/gradio_api/mcp/sse"
|
| 10 |
server = MCPServerHTTP(url=SSE_URL)
|
|
@@ -33,9 +35,8 @@ def chat_with_agent(user_input, history):
|
|
| 33 |
history.append(("user", user_input))
|
| 34 |
|
| 35 |
result = agent.run(user_input)
|
| 36 |
-
cleaned_output = re.sub(r"<think>.*?</think>", "", result.output, flags=re.DOTALL).strip()
|
| 37 |
|
| 38 |
-
history.append(("agent",
|
| 39 |
return history, history
|
| 40 |
|
| 41 |
with gr.Blocks() as demo:
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from smolagents import Agent
|
| 4 |
from smolagents.mcp import MCPServerHTTP
|
| 5 |
from smolagents.models import HuggingFaceModel
|
| 6 |
from smolagents.providers import HuggingFaceProvider
|
| 7 |
|
| 8 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 9 |
+
|
| 10 |
# MCP Server SSE URL
|
| 11 |
SSE_URL = "https://oppaai-job-search-mcp-server.hf.space/gradio_api/mcp/sse"
|
| 12 |
server = MCPServerHTTP(url=SSE_URL)
|
|
|
|
| 35 |
history.append(("user", user_input))
|
| 36 |
|
| 37 |
result = agent.run(user_input)
|
|
|
|
| 38 |
|
| 39 |
+
history.append(("agent", result))
|
| 40 |
return history, history
|
| 41 |
|
| 42 |
with gr.Blocks() as demo:
|