Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,44 +1,44 @@
|
|
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 |
-
|
11 |
-
# Paths to the images folder (use relative paths)
|
12 |
-
RAW_PATH = "
|
13 |
-
EMBEDDINGS_PATH = "
|
14 |
-
|
15 |
-
# Function to display images based on user selection
|
16 |
-
def display_images(percentage, complexity):
|
17 |
-
# Format the filenames based on user selections
|
18 |
-
raw_image_path = f"{RAW_PATH}/percentage_{percentage}_complexity_{complexity}.png"
|
19 |
-
embeddings_image_path = f"{EMBEDDINGS_PATH}/percentage_{percentage}_complexity_{complexity}.png"
|
20 |
-
|
21 |
-
# Return the corresponding images for raw and embeddings
|
22 |
-
return raw_image_path, embeddings_image_path
|
23 |
-
|
24 |
-
# Define the Gradio interface
|
25 |
-
# Step 2: Pass arrays of values for data percentage and task complexity
|
26 |
-
data_percentage_options = [10, 30, 50, 70, 100]
|
27 |
-
task_complexity_options = [16, 32]
|
28 |
-
|
29 |
-
demo = gr.Interface(
|
30 |
-
fn=display_images,
|
31 |
-
inputs=[
|
32 |
-
gr.Dropdown(data_percentage_options, label="Percentage of Data for Training"), # Dropdown for data percentage
|
33 |
-
gr.Radio(task_complexity_options, label="Task Complexity") # Radio for task complexity
|
34 |
-
],
|
35 |
-
outputs=[
|
36 |
-
gr.Image(label="Raw Channels"),
|
37 |
-
gr.Image(label="Embeddings")
|
38 |
-
],
|
39 |
-
title="Raw vs. Embeddings Inference Results",
|
40 |
-
description="Select a data percentage and task complexity to view the corresponding inference result for raw channels and embeddings."
|
41 |
-
)
|
42 |
-
|
43 |
-
if __name__ == "__main__":
|
44 |
demo.launch()
|
|
|
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 |
+
|
11 |
+
# Paths to the images folder (use relative paths)
|
12 |
+
RAW_PATH = "images/raw"
|
13 |
+
EMBEDDINGS_PATH = "images/embeddings"
|
14 |
+
|
15 |
+
# Function to display images based on user selection
|
16 |
+
def display_images(percentage, complexity):
|
17 |
+
# Format the filenames based on user selections
|
18 |
+
raw_image_path = f"{RAW_PATH}/percentage_{percentage}_complexity_{complexity}.png"
|
19 |
+
embeddings_image_path = f"{EMBEDDINGS_PATH}/percentage_{percentage}_complexity_{complexity}.png"
|
20 |
+
|
21 |
+
# Return the corresponding images for raw and embeddings
|
22 |
+
return raw_image_path, embeddings_image_path
|
23 |
+
|
24 |
+
# Define the Gradio interface
|
25 |
+
# Step 2: Pass arrays of values for data percentage and task complexity
|
26 |
+
data_percentage_options = [10, 30, 50, 70, 100]
|
27 |
+
task_complexity_options = [16, 32]
|
28 |
+
|
29 |
+
demo = gr.Interface(
|
30 |
+
fn=display_images,
|
31 |
+
inputs=[
|
32 |
+
gr.Dropdown(data_percentage_options, label="Percentage of Data for Training"), # Dropdown for data percentage
|
33 |
+
gr.Radio(task_complexity_options, label="Task Complexity") # Radio for task complexity
|
34 |
+
],
|
35 |
+
outputs=[
|
36 |
+
gr.Image(label="Raw Channels"),
|
37 |
+
gr.Image(label="Embeddings")
|
38 |
+
],
|
39 |
+
title="Raw vs. Embeddings Inference Results",
|
40 |
+
description="Select a data percentage and task complexity to view the corresponding inference result for raw channels and embeddings."
|
41 |
+
)
|
42 |
+
|
43 |
+
if __name__ == "__main__":
|
44 |
demo.launch()
|