Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -247,13 +247,21 @@ def display_predefined_images(percentage_idx):
|
|
| 247 |
return raw_image, embeddings_image
|
| 248 |
|
| 249 |
# Updated los_nlos_classification to handle missing outputs properly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
def los_nlos_classification(file, percentage_idx):
|
| 251 |
if file is not None:
|
| 252 |
raw_cm_image, emb_cm_image, console_output = process_hdf5_file(file, percentage_idx)
|
| 253 |
-
return raw_cm_image, emb_cm_image, console_output
|
| 254 |
else:
|
| 255 |
raw_image, embeddings_image = display_predefined_images(percentage_idx)
|
| 256 |
-
return raw_image, embeddings_image, "
|
| 257 |
|
| 258 |
# Function to create random images for LoS/NLoS classification results
|
| 259 |
def create_random_image(size=(300, 300)):
|
|
@@ -488,7 +496,7 @@ with gr.Blocks(css="""
|
|
| 488 |
gr.Markdown("### LoS/NLoS Classification Task")
|
| 489 |
|
| 490 |
# Radio button for user choice: predefined data or upload dataset
|
| 491 |
-
choice_radio = gr.Radio(choices=["Use
|
| 492 |
|
| 493 |
# Dropdown for selecting percentage for predefined data
|
| 494 |
percentage_dropdown_los = gr.Dropdown(choices=list(range(20)), value=0, label="Percentage of Data for Training")
|
|
|
|
| 247 |
return raw_image, embeddings_image
|
| 248 |
|
| 249 |
# Updated los_nlos_classification to handle missing outputs properly
|
| 250 |
+
#def los_nlos_classification(file, percentage_idx):
|
| 251 |
+
# if file is not None:
|
| 252 |
+
# raw_cm_image, emb_cm_image, console_output = process_hdf5_file(file, percentage_idx)
|
| 253 |
+
# return raw_cm_image, emb_cm_image, console_output
|
| 254 |
+
# else:
|
| 255 |
+
# raw_image, embeddings_image = display_predefined_images(percentage_idx)
|
| 256 |
+
# return raw_image, embeddings_image, "No file uploaded. Displaying predefined images."
|
| 257 |
+
|
| 258 |
def los_nlos_classification(file, percentage_idx):
|
| 259 |
if file is not None:
|
| 260 |
raw_cm_image, emb_cm_image, console_output = process_hdf5_file(file, percentage_idx)
|
| 261 |
+
return raw_cm_image, emb_cm_image, console_output # Returning all three: two images and console output
|
| 262 |
else:
|
| 263 |
raw_image, embeddings_image = display_predefined_images(percentage_idx)
|
| 264 |
+
return raw_image, embeddings_image, "" # Return an empty string for console output when no file is uploaded
|
| 265 |
|
| 266 |
# Function to create random images for LoS/NLoS classification results
|
| 267 |
def create_random_image(size=(300, 300)):
|
|
|
|
| 496 |
gr.Markdown("### LoS/NLoS Classification Task")
|
| 497 |
|
| 498 |
# Radio button for user choice: predefined data or upload dataset
|
| 499 |
+
choice_radio = gr.Radio(choices=["Use Default Dataset", "Upload Dataset"], label="Choose how to proceed", value="Use Predefined Data")
|
| 500 |
|
| 501 |
# Dropdown for selecting percentage for predefined data
|
| 502 |
percentage_dropdown_los = gr.Dropdown(choices=list(range(20)), value=0, label="Percentage of Data for Training")
|