Spaces:
Runtime error
Runtime error
File size: 993 Bytes
26fbd64 763a979 f3a531f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
import pandas as pd
from prophet import Prophet
def plot_forecast(example_name, period):
df = pd.read_csv(f'https://raw.githubusercontent.com/facebook/prophet/main/examples/example_{example_name}.csv')
df.columns = ['ds','y']
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=period)
forecast = m.predict(future)
fig = m.plot(forecast)
return fig
with gr.Blocks() as demo:
gr.Markdown(
"""
ๆ็ณปๅไบๆธฌใขใใซใฎ็ตๆ
""")
with gr.Row():
example = gr.Dropdown(["air_passengers", "pedestrians_covid", "retail_sales"], label="ใใผใฟใฝใผใน", value="air_passengers")
period = gr.Slider(25, 250, 25, step=25, label="ไบๆธฌๆ้")
plt = gr.Plot()
example.change(plot_forecast, [example,period], plt, queue=False)
period.change(plot_forecast, [example,period], plt, queue=False)
demo.load(plot_forecast, [example,period], plt, queue=False)
demo.launch()
|