Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,23 +12,19 @@ def execute_code_callback(code, temp, max):
|
|
| 12 |
return execute_code(code)
|
| 13 |
print("hello")
|
| 14 |
title = """Simple coding Demo"""
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
output = gr.Code(label="✨Output:", lines=40)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
if __name__ == "__main__":
|
| 34 |
-
gradio_app()
|
|
|
|
| 12 |
return execute_code(code)
|
| 13 |
print("hello")
|
| 14 |
title = """Simple coding Demo"""
|
| 15 |
+
with gr.Blocks() as demo:
|
| 16 |
+
gr.Markdown(title)
|
| 17 |
+
prompt = gr.Code(label="Enter your code prompt", value="def print_hello_world():")
|
| 18 |
+
with gr.Row():
|
| 19 |
+
temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, value=0.5, label="Temperature")
|
| 20 |
+
max_length = gr.Slider(minimum=100, maximum=1024, step=10, value=450, label="Generate Length")
|
| 21 |
+
generate_btn = gr.Button("Try✨Coding")
|
| 22 |
+
output = gr.Code(label="✨Output:", lines=40)
|
|
|
|
| 23 |
|
| 24 |
+
generate_btn.click(
|
| 25 |
+
fn=execute_code_callback,
|
| 26 |
+
inputs=[prompt, temperature, max_length],
|
| 27 |
+
outputs=output
|
| 28 |
+
)
|
| 29 |
|
| 30 |
+
demo.launch()
|
|
|
|
|
|
|
|
|