Spaces:
Sleeping
Sleeping
testnow720
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,9 @@ def execute_snippet(code_snippet: str = DEF_SNIPPET, lang: str = DEF_LANG) -> st
|
|
17 |
res = requests.request("POST", f"https://try.w3schools.com/try_{lang_param}.php", data={
|
18 |
"code": code_snippet
|
19 |
})
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
demo = gr.Interface(
|
24 |
fn=execute_snippet,
|
|
|
17 |
res = requests.request("POST", f"https://try.w3schools.com/try_{lang_param}.php", data={
|
18 |
"code": code_snippet
|
19 |
})
|
20 |
+
match lang_param:
|
21 |
+
case "php": return res.text
|
22 |
+
case _: return BeautifulSoup(res.text, "html.parser").find_all("pre")[0].string
|
23 |
|
24 |
demo = gr.Interface(
|
25 |
fn=execute_snippet,
|