Spaces:
Sleeping
Sleeping
File size: 854 Bytes
9259f41 3e3d36c 9259f41 3e3d36c 4656aee 3e3d36c 9259f41 4af178e c56669d 1c39c1b 9259f41 7c0f0b5 c56669d 9259f41 1c39c1b 9259f41 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import gradio as gr
import requests
def execute(codeSnippet, lang):
res = requests.request("POST", f"https://try.w3schools.com/try_{lang.lower()}.php", data={
"code":codeSnippet
})
return res.text
demo = gr.Interface(
fn=execute,
inputs=[
gr.Textbox(
show_label=True,
label="Code",
max_lines=4_294_967_295,
lines=4_294_967_295,
value="print('Hello, World!')",
),
gr.Dropdown(
show_label=True,
label="Language",
choices=["Python", "Java", "C", "C++", "C#", "PHP", "JavaScript"],
value="Python"
),
],
outputs=gr.Textbox(label="Result"),
title="HFChat Code Executor",
description="Enter the code snippet and language that you want to execute.",
)
demo.launch(debug=True) |