Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -20,19 +20,18 @@ def display_images(percentage, complexity):
|
|
20 |
return raw_image, embeddings_image
|
21 |
|
22 |
# Define the Gradio interface
|
23 |
-
|
24 |
-
|
25 |
-
task_complexity_range = (16, 32) # Allow complexity between 16 and 32
|
26 |
|
27 |
# Define the layout and appearance of the UI
|
28 |
with gr.Blocks() as demo:
|
29 |
gr.Markdown("# Raw vs. Embeddings Inference Results")
|
30 |
gr.Markdown("Select a data percentage and task complexity to view the corresponding inference result for raw channels and embeddings.")
|
31 |
|
32 |
-
# Inputs (using
|
33 |
with gr.Column():
|
34 |
-
|
35 |
-
|
36 |
|
37 |
# Outputs (display the images side by side and set a smaller size for the images)
|
38 |
with gr.Row():
|
@@ -40,8 +39,8 @@ with gr.Blocks() as demo:
|
|
40 |
embeddings_img = gr.Image(label="Embeddings", type="pil", width=300, height=300, interactive=False) # Smaller image size
|
41 |
|
42 |
# Trigger image updates when inputs change
|
43 |
-
|
44 |
-
|
45 |
|
46 |
# Launch the app
|
47 |
if __name__ == "__main__":
|
|
|
20 |
return raw_image, embeddings_image
|
21 |
|
22 |
# Define the Gradio interface
|
23 |
+
data_percentage_options = [10, 30, 50, 70, 100] # Specific percentage values
|
24 |
+
task_complexity_options = [16, 32] # Specific task complexity values
|
|
|
25 |
|
26 |
# Define the layout and appearance of the UI
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.Markdown("# Raw vs. Embeddings Inference Results")
|
29 |
gr.Markdown("Select a data percentage and task complexity to view the corresponding inference result for raw channels and embeddings.")
|
30 |
|
31 |
+
# Inputs (using Dropdowns for discrete values)
|
32 |
with gr.Column():
|
33 |
+
percentage_dropdown = gr.Dropdown(choices=data_percentage_options, label="Percentage of Data for Training", value=10)
|
34 |
+
complexity_dropdown = gr.Dropdown(choices=task_complexity_options, label="Task Complexity", value=16)
|
35 |
|
36 |
# Outputs (display the images side by side and set a smaller size for the images)
|
37 |
with gr.Row():
|
|
|
39 |
embeddings_img = gr.Image(label="Embeddings", type="pil", width=300, height=300, interactive=False) # Smaller image size
|
40 |
|
41 |
# Trigger image updates when inputs change
|
42 |
+
percentage_dropdown.change(fn=display_images, inputs=[percentage_dropdown, complexity_dropdown], outputs=[raw_img, embeddings_img])
|
43 |
+
complexity_dropdown.change(fn=display_images, inputs=[percentage_dropdown, complexity_dropdown], outputs=[raw_img, embeddings_img])
|
44 |
|
45 |
# Launch the app
|
46 |
if __name__ == "__main__":
|