Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ RAW_PATH = os.path.join("images", "raw")
|
|
16 |
EMBEDDINGS_PATH = os.path.join("images", "embeddings")
|
17 |
|
18 |
# Specific values for percentage of data for training
|
19 |
-
percentage_values =
|
20 |
|
21 |
# Custom class to capture print output
|
22 |
class PrintCapture(io.StringIO):
|
@@ -228,6 +228,9 @@ def process_hdf5_file(uploaded_file, percentage_idx):
|
|
228 |
percentage_idx)
|
229 |
|
230 |
# Step 8: Perform classification using the Euclidean distance for both raw and embeddings
|
|
|
|
|
|
|
231 |
pred_raw = classify_based_on_distance(train_data_raw, train_labels, test_data_raw)
|
232 |
pred_emb = classify_based_on_distance(train_data_emb, train_labels, test_data_emb)
|
233 |
print(f'pred_emb: {pred_emb}')
|
@@ -279,7 +282,12 @@ with gr.Blocks(css="""
|
|
279 |
with gr.Row():
|
280 |
with gr.Column(elem_id="slider-container"):
|
281 |
gr.Markdown("Percentage of Data for Training")
|
282 |
-
percentage_slider_bp = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
with gr.Row():
|
285 |
raw_img_bp = gr.Image(label="Raw Channels", type="pil", width=300, height=300, interactive=False)
|
|
|
16 |
EMBEDDINGS_PATH = os.path.join("images", "embeddings")
|
17 |
|
18 |
# Specific values for percentage of data for training
|
19 |
+
percentage_values = np.arange(10) + 1
|
20 |
|
21 |
# Custom class to capture print output
|
22 |
class PrintCapture(io.StringIO):
|
|
|
228 |
percentage_idx)
|
229 |
|
230 |
# Step 8: Perform classification using the Euclidean distance for both raw and embeddings
|
231 |
+
print(f'train_data_emb: {train_data_emb.shape}')
|
232 |
+
print(f'train_labels: {train_labels.shape}')
|
233 |
+
print(f'test_data_emb: {test_data_emb.shape}')
|
234 |
pred_raw = classify_based_on_distance(train_data_raw, train_labels, test_data_raw)
|
235 |
pred_emb = classify_based_on_distance(train_data_emb, train_labels, test_data_emb)
|
236 |
print(f'pred_emb: {pred_emb}')
|
|
|
282 |
with gr.Row():
|
283 |
with gr.Column(elem_id="slider-container"):
|
284 |
gr.Markdown("Percentage of Data for Training")
|
285 |
+
#percentage_slider_bp = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
|
286 |
+
percentage_dropdown_los = gr.Dropdown(choices=percenatge_values*10,
|
287 |
+
value=10,
|
288 |
+
label="Percentage of Data for Training",
|
289 |
+
interactive=True)
|
290 |
+
|
291 |
|
292 |
with gr.Row():
|
293 |
raw_img_bp = gr.Image(label="Raw Channels", type="pil", width=300, height=300, interactive=False)
|