File size: 773 Bytes
4e3fba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from transformers import pipeline

# Load the agent-builder model
model_name = "dnnsdunca/agent-builder"
agent = pipeline("text-generation", model=model_name)

def generate_response(prompt):
    response = agent(prompt, max_length=200, num_return_sequences=1)
    return response[0]['generated_text']

# Define the Gradio interface
iface = gr.Interface(
    fn=generate_response,
    inputs="text",
    outputs="text",
    title="Agent Builder",
    description="This app uses the dnnsdunca/agent-builder model to generate responses based on your input prompts.",
    examples=[
        ["What is the weather like today?"],
        ["Write a Python function to reverse a string."]
    ]
)

# Launch the app
if __name__ == "__main__":
    iface.launch()