Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
-
def execute(
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|