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 = np.arange(9) + 1
|
20 |
|
21 |
# Custom class to capture print output
|
22 |
class PrintCapture(io.StringIO):
|
@@ -139,7 +139,7 @@ def identical_train_test_split(output_emb, output_raw, labels, percentage_idx):
|
|
139 |
indices = torch.randperm(N) # Randomly shuffle the indices
|
140 |
|
141 |
# Calculate the split index
|
142 |
-
split_index = int(N * percentage_values[percentage_idx
|
143 |
print(f'Training Size: {split_index}')
|
144 |
|
145 |
# Split indices into train and test
|
@@ -221,7 +221,7 @@ def process_hdf5_file(uploaded_file, percentage_idx):
|
|
221 |
print(f"Output Raw Shape: {output_raw.shape}")
|
222 |
|
223 |
print(f'percentage_idx: {percentage_idx}')
|
224 |
-
print(f'percentage_value: {percentage_values[percentage_idx
|
225 |
train_data_emb, test_data_emb, train_data_raw, test_data_raw, train_labels, test_labels = identical_train_test_split(output_emb.view(len(output_emb),-1),
|
226 |
output_raw.view(len(output_raw),-1),
|
227 |
labels,
|
@@ -299,8 +299,8 @@ with gr.Blocks(css="""
|
|
299 |
with gr.Column(elem_id="slider-container"):
|
300 |
gr.Markdown("Percentage of Data for Training")
|
301 |
#percentage_slider_los = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
|
302 |
-
percentage_dropdown_los = gr.Dropdown(choices=[
|
303 |
-
value=
|
304 |
label="Percentage of Data for Training",
|
305 |
interactive=True)
|
306 |
|
|
|
16 |
EMBEDDINGS_PATH = os.path.join("images", "embeddings")
|
17 |
|
18 |
# Specific values for percentage of data for training
|
19 |
+
percentage_values = (np.arange(9) + 1)*100
|
20 |
|
21 |
# Custom class to capture print output
|
22 |
class PrintCapture(io.StringIO):
|
|
|
139 |
indices = torch.randperm(N) # Randomly shuffle the indices
|
140 |
|
141 |
# Calculate the split index
|
142 |
+
split_index = int(N * percentage_values[percentage_idx]/100)
|
143 |
print(f'Training Size: {split_index}')
|
144 |
|
145 |
# Split indices into train and test
|
|
|
221 |
print(f"Output Raw Shape: {output_raw.shape}")
|
222 |
|
223 |
print(f'percentage_idx: {percentage_idx}')
|
224 |
+
print(f'percentage_value: {percentage_values[percentage_idx]}')
|
225 |
train_data_emb, test_data_emb, train_data_raw, test_data_raw, train_labels, test_labels = identical_train_test_split(output_emb.view(len(output_emb),-1),
|
226 |
output_raw.view(len(output_raw),-1),
|
227 |
labels,
|
|
|
299 |
with gr.Column(elem_id="slider-container"):
|
300 |
gr.Markdown("Percentage of Data for Training")
|
301 |
#percentage_slider_los = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
|
302 |
+
percentage_dropdown_los = gr.Dropdown(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8]
|
303 |
+
value=5,
|
304 |
label="Percentage of Data for Training",
|
305 |
interactive=True)
|
306 |
|