Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,43 +31,15 @@ def gradio_interface(question, context, max_length, num_beams, early_stopping):
|
|
31 |
# Gradio UI Components
|
32 |
question_input = gr.Textbox(label="Enter the Question", value="what is the total amount of players for the rockets in 1998 only?")
|
33 |
context_input = gr.Textbox(label="Enter the Context", value="df = pd.DataFrame(columns=['player', 'years_for_rockets'])")
|
34 |
-
max_length_input = gr.Slider(minimum=50, maximum=1024, value=512, label="Max Length")
|
35 |
-
num_beams_input = gr.Slider(minimum=1, maximum=10, value=4, label="Number of Beams")
|
36 |
early_stopping_input = gr.Checkbox(value=True, label="Early Stopping")
|
37 |
|
38 |
-
# Custom CSS to style the slider, checkbox, and center the button
|
39 |
-
custom_css = """
|
40 |
-
/* Make the slider handle and bar light green */
|
41 |
-
input[type="range"] {
|
42 |
-
accent-color: lightgreen;
|
43 |
-
}
|
44 |
-
input[type="range"]::-webkit-slider-thumb {
|
45 |
-
background-color: #90EE90; /* Light green slider thumb */
|
46 |
-
}
|
47 |
-
input[type="range"]::-webkit-slider-runnable-track {
|
48 |
-
background-color: #32CD32; /* Light green slider track */
|
49 |
-
}
|
50 |
-
/* Make the checkbox light green */
|
51 |
-
input[type="checkbox"] {
|
52 |
-
accent-color: lightgreen;
|
53 |
-
}
|
54 |
-
/* Center the button */
|
55 |
-
.gr-button.gr-button-primary {
|
56 |
-
display: block;
|
57 |
-
margin: 0 auto;
|
58 |
-
background-color: #90EE90; /* Light green button */
|
59 |
-
color: black;
|
60 |
-
border-radius: 8px;
|
61 |
-
border: 2px solid #006400; /* Dark green border */
|
62 |
-
}
|
63 |
-
"""
|
64 |
-
|
65 |
# Create Gradio Interface
|
66 |
gr.Interface(
|
67 |
fn=gradio_interface,
|
68 |
inputs=[question_input, context_input, max_length_input, num_beams_input, early_stopping_input],
|
69 |
outputs="text",
|
70 |
title="Text to Pandas Code Generator",
|
71 |
-
description="Generate Pandas code by providing a question and a context."
|
72 |
-
css=custom_css, # Apply the custom CSS
|
73 |
).launch()
|
|
|
31 |
# Gradio UI Components
|
32 |
question_input = gr.Textbox(label="Enter the Question", value="what is the total amount of players for the rockets in 1998 only?")
|
33 |
context_input = gr.Textbox(label="Enter the Context", value="df = pd.DataFrame(columns=['player', 'years_for_rockets'])")
|
34 |
+
max_length_input = gr.Slider(minimum=50, maximum=1024, value=512, label="Max Length", step=1) # Step=1 makes it integer only
|
35 |
+
num_beams_input = gr.Slider(minimum=1, maximum=10, value=4, label="Number of Beams", step=1) # Step=1 makes it integer only
|
36 |
early_stopping_input = gr.Checkbox(value=True, label="Early Stopping")
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Create Gradio Interface
|
39 |
gr.Interface(
|
40 |
fn=gradio_interface,
|
41 |
inputs=[question_input, context_input, max_length_input, num_beams_input, early_stopping_input],
|
42 |
outputs="text",
|
43 |
title="Text to Pandas Code Generator",
|
44 |
+
description="Generate Pandas code by providing a question and a context."
|
|
|
45 |
).launch()
|