First_agent_template / Gradio_UI.py
21spl's picture
Update Gradio_UI.py
d88a433 verified
raw
history blame contribute delete
608 Bytes
import gradio as gr
from smolagents import CodeAgent
import gradio as gr
from app import get_weather # Ensure this function is correctly imported from the main script
def weather_interface(city):
return get_weather(city)
# Define Gradio UI components
with gr.Blocks() as demo:
gr.Markdown("# Weather Information App")
city = gr.Textbox(label="Enter City Name")
get_weather_button = gr.Button("Get Weather")
output = gr.Textbox(label="Weather Details")
get_weather_button.click(weather_interface, inputs=[city], outputs=output)
if __name__ == "__main__":
demo.launch()