Spaces:
Sleeping
Sleeping
File size: 614 Bytes
f4bce63 df8340d f4bce63 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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({'weight': x, 'height': y})
fig=px.scatter(data, x='weight', y='height')
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()
|