Spaces:
Runtime error
Runtime error
Update app.py
Browse files12345613 unmodified lines202122232425262728293031322 unmodified lines35363738394041424344from smolagents import CodeAgent, HfApiModel, toolimport yamlfrom Gradio_UI import GradioUI# Define a tool to generate motivational quotes@tool13 unmodified linesmodel = HfApiModel(max_tokens=2096,temperature=0.5,model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud')# Load prompt templateswith open("prompts.yaml", 'r') as stream:prompt_templates = yaml.safe_load(stream)# Create the agentagent = CodeAgent(model=model,2 unmodified linesverbosity_level=1,name="MotivationAgent",description="An agent that provides motivational quotes to inspire users.",prompt_templates=prompt_templates,)# Launch the Gradio UIGradioUI(agent).launch()123456713 unmodified lines2122232425262728293031322 unmodified lines353637383940414243444546474849505152from smolagents import CodeAgent, HfApiModel, toolimport yamlfrom Gradio_UI import GradioUIimport gradio as gr# Define a tool to generate motivational quotes@tool13 unmodified linesmodel = HfApiModel(max_tokens=2096,temperature=0.5,model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud')# Load prompt templateswith open("prompts.yaml", 'r') as stream:prompt_templates = yaml.safe_load(stream)# Create the agentagent = CodeAgent(model=model,2 unmodified linesverbosity_level=1,name="MotivationAgent",description="An agent that provides motivational quotes to inspire users.",prompt_templates=prompt_templates,)# Launch the Gradio UI with custom interactiondef respond(user_input):quote = get_motivational_quote() # Get a quote immediatelyreturn quote # Return the quote to display in the outputwith gr.Blocks() as demo:text_input = gr.Textbox()text_output = gr.Textbox()text_input.change(respond, inputs=text_input, outputs=text_output) # Trigger on input changedemo.launch()
app.py+15-7