File size: 1,022 Bytes
87d5467
8965fc9
87d5467
 
8965fc9
87d5467
 
 
 
 
 
 
 
 
 
 
 
8965fc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import gradio as gr
from huggingface_hub import Agent

# Initialize the agent with the specified model and server configuration
agent = Agent(
    model="Qwen/Qwen2.5-72B-Instruct",
    provider="nebius",
    servers=[
        {
            "command": "npx",
            "args": [
                "mcp-remote",
                "http://amiel-mcp-sentiment-3.hf.space/gradio_api/mcp/sse"  # Your Gradio MCP server
            ]
        }
    ],
)

# Define a function to interact with the agent
def interact_with_agent(input_text):
    # Here, you would typically call the agent's method to process the input_text
    # For demonstration, we'll just return a placeholder response
    return f"Processed: {input_text}"

# Create a Gradio interface for the agent
demo = gr.Interface(
    fn=interact_with_agent,
    inputs="text",
    outputs="text",
    title="Agent Interaction",
    description="Enter text to interact with the agent."
)

# Launch the Gradio interface
if __name__ == "__main__":
    demo.launch()