import altair import gradio as gr from math import sqrt import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np # import plotly.express as px import pandas as pd df_pre = pd.read_csv('data.csv') y = df_pre['audience'] def outbreak(date): if date: # start_day = start_day # final_day = date # x = np.arange(start_day, final_day + 1) fig = plt.figure() plt.plot(y) plt.title("観客数予測") plt.ylabel("観客数") plt.xlabel("Days since Day 0") return fig demo = gr.Interface( fn=outbreak, inputs='checkbox', outputs=gr.Plot() ) if __name__ == "__main__": demo.launch()