xiddiqui's picture
updated app.py file, updated graphs
bf0a0b6
raw
history blame
1.08 kB
from datasets import load_dataset
import gradio as gr
import pandas as pd
import plotly.express as px
# Load dataset
ds = load_dataset("egecandrsn/weatherdata")
df = pd.DataFrame(ds['train'])
df['datetime'] = pd.to_datetime(df['datetime'])
# Create Graphs
def create_graphs():
# Temperature over Time
fig_temp = px.line(df, x='datetime', y='temp', title='Temperature Over Time')
# Precipitation over Time
fig_precip = px.line(df, x='datetime', y='precip', title='Precipitation Over Time')
# Wind Speed over Time
fig_wind = px.line(df, x='datetime', y='windspeed', title='Wind Speed Over Time')
# Return multiple graphs
return fig_temp, fig_precip, fig_wind
# Create Gradio interface
interface = gr.Interface(
fn=create_graphs,
inputs=None, # No input required, as we are just displaying graphs
outputs=[gr.Plot(), gr.Plot(), gr.Plot()], # Multiple graph outputs
title="Weather Data Analysis",
description="This app shows multiple weather analysis graphs based on the dataset."
)
# Launch the interface
interface.launch()