File size: 734 Bytes
			
			| 28745e6 81bf60b 28745e6 81bf60b 28745e6 81bf60b 28745e6 81bf60b 28745e6 81bf60b 28745e6 | 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 | import gradio as gr
import matplotlib.pyplot as plt
import pandas as pd
# サンプルデータ
data = {
    '年月': ['2023-01', '2023-02', '2023-03', '2023-04', '2023-05', '2023-06'],
    '乗客数': [1200, 1500, 1700, 1600, 1800, 2000]
}
df = pd.DataFrame(data)
def plot_passenger_trends():
    fig, ax = plt.subplots()
    ax.plot(df['年月'], df['乗客数'], marker='o')
    ax.set_title('JRの乗客数の推移')
    ax.set_xlabel('年月')
    ax.set_ylabel('乗客数 (千人)')
    return fig
# Gradioインターフェースの定義
iface = gr.Interface(
    fn=plot_passenger_trends,
    inputs=[],
    outputs=gr.components.Plot(label="JRの乗客数の推移")
)
if __name__ == "__main__":
    iface.launch()
 | 
