Spaces:
Sleeping
Sleeping
import gradio as gr | |
import pandas as pd | |
import plotly.express as px | |
def plot_scatter_chart(): | |
x=[49, 65, 53, 45, 56, 47, 52, 61] # 體重 | |
y=[159, 177, 156, 163, 164, 158, 166, 171] # 身高 | |
data=pd.DataFrame({'體重': x, '體重': y}) | |
fig=px.scatter(data, x='體重', y='身高') | |
return fig # 傳回 Figure 物件 | |
iface=gr.Interface( | |
fn=plot_scatter_chart, # 繪製函數 | |
inputs=[], # 無需用戶輸入 | |
outputs=gr.Plot(), # 輸出為 Gradio 的 Plot 物件 | |
title='Scatter Plot Test(with Plotly)', | |
flagging_mode='never', | |
) | |
iface.launch() | |