Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,19 @@ def display_images(percentage, complexity):
|
|
20 |
return raw_image, embeddings_image
|
21 |
|
22 |
# Define the Gradio interface
|
23 |
-
|
24 |
-
|
|
|
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 |
-
#
|
32 |
-
with gr.Column(
|
33 |
-
|
34 |
-
|
35 |
|
36 |
# Outputs (display the images side by side and set a smaller size for the images)
|
37 |
with gr.Row():
|
@@ -39,16 +40,8 @@ with gr.Blocks() as demo:
|
|
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 |
-
|
43 |
-
|
44 |
-
|
45 |
-
# Add custom CSS for scrollable area
|
46 |
-
demo.css = """
|
47 |
-
#scrollable-configs {
|
48 |
-
max-height: 150px;
|
49 |
-
overflow-y: auto;
|
50 |
-
}
|
51 |
-
"""
|
52 |
|
53 |
# Launch the app
|
54 |
if __name__ == "__main__":
|
|
|
20 |
return raw_image, embeddings_image
|
21 |
|
22 |
# Define the Gradio interface
|
23 |
+
# Use sliders to make the user interaction smoother
|
24 |
+
data_percentage_range = (10, 100) # Allow percentages between 10 and 100
|
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 sliders for smoother tuning)
|
33 |
+
with gr.Column():
|
34 |
+
percentage_slider = gr.Slider(minimum=10, maximum=100, step=10, label="Percentage of Data for Training", value=10)
|
35 |
+
complexity_slider = gr.Slider(minimum=16, maximum=32, step=4, label="Task Complexity", value=16)
|
36 |
|
37 |
# Outputs (display the images side by side and set a smaller size for the images)
|
38 |
with gr.Row():
|
|
|
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 |
+
percentage_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
|
44 |
+
complexity_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
# Launch the app
|
47 |
if __name__ == "__main__":
|