testnow720 commited on
Commit
b5549b2
·
verified ·
1 Parent(s): 4656aee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,9 +1,16 @@
1
  import gradio as gr
2
  import requests
3
 
4
- def execute(codeSnippet, lang):
5
- res = requests.request("POST", f"https://try.w3schools.com/try_{lang.lower()}.php", data={
6
- "code":codeSnippet
 
 
 
 
 
 
 
7
  })
8
  return res.text
9
 
 
1
  import gradio as gr
2
  import requests
3
 
4
+ def execute(code_snippet, lang):
5
+ lang_param = None
6
+
7
+ match lang:
8
+ case "c++": lang_param = "cpp"
9
+ case "C#": lang_param = "cs"
10
+ case _: lang_param = lang.lower()
11
+
12
+ res = requests.request("POST", f"https://try.w3schools.com/try_{lang_param}.php", data={
13
+ "code": code_snippet
14
  })
15
  return res.text
16