pbolo commited on
Commit
91d188a
·
verified ·
1 Parent(s): e00a47d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -12
app.py CHANGED
@@ -15,18 +15,32 @@ def explain(input: str, lang: str):
15
 
16
  _allow_langs=["English", "Chinese", "Japanese"]
17
 
18
- with gr.Blocks() as demo:
19
- gr.Markdown('# concept explain')
20
-
21
- with gr.Row():
22
- with gr.Column():
23
- explain_input=gr.Textbox(label="Concept")
24
- explain_lang=gr.Dropdown(label="Language", choices=_allow_langs, value=_allow_langs[0])
25
- explain_btn=gr.Button("Run", variant="primary")
26
- with gr.Column():
27
- explain_result=gr.Textbox(label="Result")
28
-
29
- explain_btn.click(fn=explain, inputs=[explain_input, explain_lang], outputs=[explain_result])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  if __name__=="__main__":
32
  demo.launch()
 
15
 
16
  _allow_langs=["English", "Chinese", "Japanese"]
17
 
18
+ demo = gr.Interface(
19
+ fn=explain,
20
+ inputs=[
21
+ gr.Textbox(label="Concept"),
22
+ gr.Dropdown(label="Language", choices=_allow_langs, value="English"),
23
+ ],
24
+ outputs=[
25
+ 'text',
26
+ ],
27
+ title="Explainer",
28
+ description="an easy way to explain a concept in other language, get a better expression.",
29
+ head='<meta name="description" content="explain a concept in other language, get a better expression.">',
30
+ )
31
+
32
+ # with gr.Blocks() as demo:
33
+ # gr.Markdown('# concept explain')
34
+
35
+ # with gr.Row():
36
+ # with gr.Column():
37
+ # explain_input=gr.Textbox(label="Concept")
38
+ # explain_lang=gr.Dropdown(label="Language", choices=_allow_langs, value=_allow_langs[0])
39
+ # explain_btn=gr.Button("Run", variant="primary")
40
+ # with gr.Column():
41
+ # explain_result=gr.Textbox(label="Result")
42
+
43
+ # explain_btn.click(fn=explain, inputs=[explain_input, explain_lang], outputs=[explain_result])
44
 
45
  if __name__=="__main__":
46
  demo.launch()