Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,8 @@ def create_config(model_name, num_labels, use_cache):
|
|
| 29 |
return str(config) # Return the configuration as a string.
|
| 30 |
|
| 31 |
# Start building the Gradio interface
|
| 32 |
-
with gr.
|
|
|
|
| 33 |
gr.Markdown("## Config Class - Transformers") # Display a title for the web interface.
|
| 34 |
with gr.Row(): # Create a row in the interface to organize elements horizontally.
|
| 35 |
# Dropdown menu to select a model.
|
|
@@ -41,9 +42,9 @@ with gr.Blocks() as demo:
|
|
| 41 |
# Numeric input for the number of labels (used in the model configuration).
|
| 42 |
num_labels_input = gr.Number(label="Number of Labels", value=2)
|
| 43 |
# Checkbox for users to decide whether to use caching.
|
| 44 |
-
use_cache_input = gr.Checkbox(label="Use Cache", value=
|
| 45 |
# Textbox to display the generated configuration.
|
| 46 |
-
output_area = gr.Textbox(label="Config Output")
|
| 47 |
# Button to create the configuration.
|
| 48 |
submit_button = gr.Button("Create Config")
|
| 49 |
|
|
@@ -53,4 +54,4 @@ with gr.Blocks() as demo:
|
|
| 53 |
submit_button.click(fn=create_config, inputs=[model_dropdown, num_labels_input, use_cache_input], outputs=output_area)
|
| 54 |
|
| 55 |
# Launch the Gradio interface.
|
| 56 |
-
demo.launch()
|
|
|
|
| 29 |
return str(config) # Return the configuration as a string.
|
| 30 |
|
| 31 |
# Start building the Gradio interface
|
| 32 |
+
with gr.Group(elem_id="UI-conf")
|
| 33 |
+
with gr.Blocks() as demo:
|
| 34 |
gr.Markdown("## Config Class - Transformers") # Display a title for the web interface.
|
| 35 |
with gr.Row(): # Create a row in the interface to organize elements horizontally.
|
| 36 |
# Dropdown menu to select a model.
|
|
|
|
| 42 |
# Numeric input for the number of labels (used in the model configuration).
|
| 43 |
num_labels_input = gr.Number(label="Number of Labels", value=2)
|
| 44 |
# Checkbox for users to decide whether to use caching.
|
| 45 |
+
use_cache_input = gr.Checkbox(label="Use Cache", value=true)
|
| 46 |
# Textbox to display the generated configuration.
|
| 47 |
+
output_area = gr.Textbox(label="Config Output",)
|
| 48 |
# Button to create the configuration.
|
| 49 |
submit_button = gr.Button("Create Config")
|
| 50 |
|
|
|
|
| 54 |
submit_button.click(fn=create_config, inputs=[model_dropdown, num_labels_input, use_cache_input], outputs=output_area)
|
| 55 |
|
| 56 |
# Launch the Gradio interface.
|
| 57 |
+
demo.launch()
|