tony1966 commited on
Commit
f4bce63
1 Parent(s): 12d0f67

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import plotly.express as px
4
+
5
+ def plot_scatter_chart():
6
+ x=[49, 65, 53, 45, 56, 47, 52, 61] # 體重
7
+ y=[159, 177, 156, 163, 164, 158, 166, 171] # 身高
8
+ data=pd.DataFrame({'體重': x, '體重': y})
9
+ fig=px.scatter(data, x='體重', y='身高')
10
+ return fig # 傳回 Figure 物件
11
+
12
+ iface=gr.Interface(
13
+ fn=plot_scatter_chart, # 繪製函數
14
+ inputs=[], # 無需用戶輸入
15
+ outputs=gr.Plot(), # 輸出為 Gradio 的 Plot 物件
16
+ title='Scatter Plot Test(with Plotly)',
17
+ flagging_mode='never',
18
+ )
19
+
20
+ iface.launch()