Sadjad Alikhani commited on
Commit
fc61532
·
verified ·
1 Parent(s): eeb051e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
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
- # 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,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
- 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__":
 
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__":