YaTharThShaRma999 commited on
Commit
e37b851
·
verified ·
1 Parent(s): dbd2c54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -18
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
- def gradio_app():
16
- with gr.Blocks() as demo:
17
- gr.Markdown(title)
18
- prompt = gr.Code(label="Enter your code prompt", value="def print_hello_world():")
19
- with gr.Row():
20
- temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, value=0.5, label="Temperature")
21
- max_length = gr.Slider(minimum=100, maximum=1024, step=10, value=450, label="Generate Length")
22
- generate_btn = gr.Button("TryCoding")
23
- output = gr.Code(label="✨Output:", lines=40)
24
 
25
- generate_btn.click(
26
- fn=execute_code_callback,
27
- inputs=[prompt, temperature, max_length],
28
- outputs=output
29
- )
30
 
31
- demo.launch()
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()