zcfrank1st commited on
Commit
fa6c371
·
verified ·
1 Parent(s): 441f741

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -20,9 +20,10 @@ def call_company(p):
20
  return response.output.text
21
 
22
 
23
- def run_flow(input_value):
24
- if input_value == "公司净调":
25
- return call_company(input_value)
 
26
  else:
27
  pass
28
 
@@ -32,11 +33,12 @@ with gr.Blocks() as demo:
32
  with gr.Column():
33
  scene = gr.Dropdown(
34
  ["公司净调", ], label="场景", info="请选择场景"
35
- ),
36
  text = gr.Textbox(label="输入")
37
  btn = gr.Button("开始")
38
  with gr.Column():
39
- result = gr.Textbox(label="结果")
40
- btn.click(fn=run_flow, inputs=scene, outputs=result)
 
41
 
42
  demo.launch()
 
20
  return response.output.text
21
 
22
 
23
+ def run_flow(scene, text):
24
+ print(scene, text)
25
+ if scene == "公司净调":
26
+ return call_company(text)
27
  else:
28
  pass
29
 
 
33
  with gr.Column():
34
  scene = gr.Dropdown(
35
  ["公司净调", ], label="场景", info="请选择场景"
36
+ )
37
  text = gr.Textbox(label="输入")
38
  btn = gr.Button("开始")
39
  with gr.Column():
40
+ result = gr.Markdown(label="结果", show_label=True, container=True, min_height=100)
41
+
42
+ btn.click(fn=run_flow, inputs=[scene, text], outputs=result)
43
 
44
  demo.launch()