Spaces:
Runtime error
Runtime error
| 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() | |