Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,19 +30,6 @@ def main(prompt, max_length=200, temperature=0.5):
|
|
30 |
response = generate_response(prompt, max_length, temperature)
|
31 |
return response
|
32 |
|
33 |
-
# Enhanced Gradio Interface
|
34 |
-
iface = gr.Interface(
|
35 |
-
fn=main,
|
36 |
-
inputs=[
|
37 |
-
gr.Textbox(label="Enter your prompt", placeholder="Enter your prompt here...", lines=5),
|
38 |
-
gr.Slider(label="Max Length", min_value=50, max_value=500, default_value=200, step=10, granularity=1, hide_text=True),
|
39 |
-
gr.Slider(label="Temperature", min_value=0.1, max_value=1.0, default_value=0.5, step=0.1, granularity=0.01, hide_text=True)
|
40 |
-
],
|
41 |
-
outputs=gr.Textbox(label="Generated Code", placeholder="Generated code will appear here...", lines=15),
|
42 |
-
title="Code Assistant",
|
43 |
-
description="Enter your prompt and get responses from the code generation model. Adjust the max length and temperature to customize the output."
|
44 |
-
)
|
45 |
-
|
46 |
# Adding real-time feedback
|
47 |
def real_time_feedback(prompt):
|
48 |
# Validate prompt and provide feedback
|
@@ -60,27 +47,4 @@ def format_code(code):
|
|
60 |
# Adding interactive elements
|
61 |
def interactive_elements(prompt, max_length=200, temperature=0.5):
|
62 |
# Provide interactive feedback and formatting
|
63 |
-
feedback = real_time_feedback(
|
64 |
-
code = main(prompt, max_length, temperature)
|
65 |
-
formatted_code = format_code(code)
|
66 |
-
return feedback, formatted_code
|
67 |
-
|
68 |
-
# Enhanced Gradio Interface with interactive elements
|
69 |
-
interactive_iface = gr.Interface(
|
70 |
-
fn=interactive_elements,
|
71 |
-
inputs=[
|
72 |
-
gr.Textbox(label="Enter your prompt", placeholder="Enter your prompt here...", lines=5),
|
73 |
-
gr.Slider(label="Max Length", min_value=50, max_value=500, default_value=200, step=10, granularity=1, hide_text=True),
|
74 |
-
gr.Slider(label="Temperature", min_value=0.1, max_value=1.0, default_value=0.5, step=0.1, granularity=0.01, hide_text=True)
|
75 |
-
],
|
76 |
-
outputs=[
|
77 |
-
gr.Textbox(label="Real-Time Feedback", placeholder="Real-time feedback will appear here...", lines=1),
|
78 |
-
gr.HTML(label="Generated Code", html=True, placeholder="Generated code will appear here...")
|
79 |
-
],
|
80 |
-
title="Enhanced Code Assistant",
|
81 |
-
description="Enter your prompt and get responses from the code generation model. Adjust the max length and temperature to customize the output."
|
82 |
-
)
|
83 |
-
|
84 |
-
# Launch the Gradio Interface
|
85 |
-
if __name__ == "__main__":
|
86 |
-
interactive_iface.launch()
|
|
|
30 |
response = generate_response(prompt, max_length, temperature)
|
31 |
return response
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# Adding real-time feedback
|
34 |
def real_time_feedback(prompt):
|
35 |
# Validate prompt and provide feedback
|
|
|
47 |
# Adding interactive elements
|
48 |
def interactive_elements(prompt, max_length=200, temperature=0.5):
|
49 |
# Provide interactive feedback and formatting
|
50 |
+
feedback = real_time_feedback(pr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|