import gradio as gr from transformers import pipeline # Load the weather question answering model from Hugging Face model = pipeline("question-answering", model="mrm8488/t5-base-finetuned-weather-questions") def get_weather(question): # Use the weather question answering model to get the answer answer = model({ "question": question, "context": "The weather today is sunny with a temperature of 25 degrees Celsius." }) return answer["answer"] # Create a Gradio interface for the weather app def app(): weather_question = gr.inputs.Textbox(lines=2, label="Ask a weather-related question") result = gr.outputs.Textbox(label="Answer") gr.Interface(fn=get_weather, inputs=weather_question, outputs=result).launch() # Run the weather app app()