changxin commited on
Commit
5476739
·
1 Parent(s): bf98b6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -90,6 +90,9 @@ def plot(v, a):
90
  plt.ylim(0, 60)
91
  return fig
92
 
 
 
 
93
  with demo:
94
  gr.Markdown(
95
  """
@@ -135,11 +138,16 @@ with demo:
135
  zz2_output = gr.Textbox(label="输出",show_label=True)
136
  zz2_button = gr.Button("开始正则替换>>")
137
  with gr.TabItem("图表展示"):
138
- with gr.Group():
139
- speed = gr.Slider(1, 30, 25, label="Speed")
140
- angle = gr.Slider(0, 90, 45, label="Angle")
141
- output = gr.Plot()
142
- tb_button = gr.Button("Run")
 
 
 
 
 
143
 
144
  tj_button.click(fx1, inputs=text_input, outputs=text_output)
145
  cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
@@ -150,5 +158,6 @@ with demo:
150
  zz1_button.click(fx7,inputs=zz1_input,outputs=zz1_output,api_name="zzpp")
151
  zz2_button.click(fx8,inputs=zz2_input,outputs=zz2_output,api_name="zzth")
152
  tb_button.click(plot, [speed, angle], output)
 
153
 
154
  demo.launch(enable_queue=True)
 
90
  plt.ylim(0, 60)
91
  return fig
92
 
93
+ def fx9(x):
94
+ return x.plot()
95
+
96
  with demo:
97
  gr.Markdown(
98
  """
 
138
  zz2_output = gr.Textbox(label="输出",show_label=True)
139
  zz2_button = gr.Button("开始正则替换>>")
140
  with gr.TabItem("图表展示"):
141
+ with gr.Row():
142
+ with gr.Group():
143
+ speed = gr.Slider(1, 30, 25, label="Speed")
144
+ angle = gr.Slider(0, 90, 45, label="Angle")
145
+ output = gr.Plot()
146
+ tb_button = gr.Button("Run")
147
+ with gr.Column():
148
+ pd_input=gr.Dataframe(headers=['项目','数据'],value=[['a',10],['b',15]],label="可编辑数据框",interactive=True)
149
+ pd_output=gr.Plot()
150
+ pd_button=gr.Button("编辑测试")
151
 
152
  tj_button.click(fx1, inputs=text_input, outputs=text_output)
153
  cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
 
158
  zz1_button.click(fx7,inputs=zz1_input,outputs=zz1_output,api_name="zzpp")
159
  zz2_button.click(fx8,inputs=zz2_input,outputs=zz2_output,api_name="zzth")
160
  tb_button.click(plot, [speed, angle], output)
161
+ pd_button.click(fx9,pd_input,pd_output)
162
 
163
  demo.launch(enable_queue=True)