testnow720 commited on
Commit
78b7b93
·
verified ·
1 Parent(s): 356c16b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- print(BeautifulSoup(res.text, "html.parser").find_all("pre"))
21
- return BeautifulSoup(res.text, "html.parser").find_all("pre")[0].string
 
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,