Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,3 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""
|
3 |
-
Created on Tue Sep 17 15:03:39 2024
|
4 |
-
|
5 |
-
@author: salikha4
|
6 |
-
"""
|
7 |
-
|
8 |
import gradio as gr
|
9 |
import os
|
10 |
from PIL import Image
|
@@ -30,19 +23,25 @@ def display_images(percentage, complexity):
|
|
30 |
data_percentage_options = [10, 30, 50, 70, 100]
|
31 |
task_complexity_options = [16, 32]
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
gr.
|
41 |
-
gr.
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
)
|
|
|
|
|
|
|
|
|
|
|
46 |
|
|
|
47 |
if __name__ == "__main__":
|
48 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
from PIL import Image
|
|
|
23 |
data_percentage_options = [10, 30, 50, 70, 100]
|
24 |
task_complexity_options = [16, 32]
|
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 (data percentage and task complexity)
|
32 |
+
with gr.Row():
|
33 |
+
percentage_dropdown = gr.Dropdown(data_percentage_options, label="Percentage of Data for Training", value=10)
|
34 |
+
complexity_radio = gr.Radio(task_complexity_options, label="Task Complexity", value=16)
|
35 |
+
|
36 |
+
# Outputs (display the images side by side)
|
37 |
+
with gr.Row():
|
38 |
+
raw_img = gr.Image(label="Raw Channels", type="pil", interactive=False)
|
39 |
+
embeddings_img = gr.Image(label="Embeddings", type="pil", interactive=False)
|
40 |
+
|
41 |
+
# Update images instantaneously without clicking submit
|
42 |
+
percentage_dropdown.change(fn=display_images, inputs=[percentage_dropdown, complexity_radio], outputs=[raw_img, embeddings_img], live=True)
|
43 |
+
complexity_radio.change(fn=display_images, inputs=[percentage_dropdown, complexity_radio], outputs=[raw_img, embeddings_img], live=True)
|
44 |
|
45 |
+
# Launch the app
|
46 |
if __name__ == "__main__":
|
47 |
demo.launch()
|