testnow720 commited on
Commit
c56669d
·
verified ·
1 Parent(s): 4af178e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -1,8 +1,11 @@
1
  import gradio as gr
2
 
3
  def execute(code, lang):
4
- #return "Typeof code : " + str(type(code) + "\nCode : " + str(code) + "\nTypeof language : " + type(lang) + "\nLanguage : " + str(lang)
5
- return f"Typeof code : {str(type(code))}\nCode : {str(code)}\nTypeof lang : {str(type(lang))}\nLanguage : {str(lang)}"
 
 
 
6
 
7
  demo = gr.Interface(
8
  fn=execute,
@@ -11,16 +14,15 @@ demo = gr.Interface(
11
  show_label=True,
12
  label="Code",
13
  max_lines=4_294_967_295,
14
- lines=4_294_967_295
15
  ),
16
  gr.Dropdown(
17
  show_label=True,
18
  label="Language",
19
- choices=["Python"]
20
- )
21
  ],
22
- outputs="text"
23
-
24
  )
25
 
26
  demo.launch(debug=True)
 
1
  import gradio as gr
2
 
3
  def execute(code, lang):
4
+ match lang:
5
+ case "Python":
6
+ return "Python
7
+ case _:
8
+ return f"Code : {str(code)}\nTypeof lang : {str(type(lang))}\nLanguage : {str(lang)}"
9
 
10
  demo = gr.Interface(
11
  fn=execute,
 
14
  show_label=True,
15
  label="Code",
16
  max_lines=4_294_967_295,
17
+ lines=4_294_967_295,
18
  ),
19
  gr.Dropdown(
20
  show_label=True,
21
  label="Language",
22
+ choices=["Python"],
23
+ ),
24
  ],
25
+ outputs=gr.Textbox(label="Result")
 
26
  )
27
 
28
  demo.launch(debug=True)