Spaces:
Paused
Paused
Commit
•
6d36038
1
Parent(s):
58da85a
Update app.py
Browse files
app.py
CHANGED
@@ -174,13 +174,6 @@ def process_input(image_path):
|
|
174 |
print(probs)
|
175 |
print(idxs)
|
176 |
|
177 |
-
# Swap class to index mapping with index to class mapping and then map the classes to flower category labels using the json file
|
178 |
-
#idx_to_class = {v: k for k, v in pretrained_model.class_to_idx.items()}
|
179 |
-
#with open('cat_to_name.json','r') as f:
|
180 |
-
# cat_to_name = json.load(f)
|
181 |
-
#names = list(map(lambda x: cat_to_name[f"{idx_to_class[x]}"],idxs))
|
182 |
-
#return names, probs
|
183 |
-
#return { idxs[i].item() : float(probs[i].item()) for i in range(len(idxs))}
|
184 |
return { idxs : float(probs) }
|
185 |
|
186 |
#append to list to be returned at end
|
@@ -198,4 +191,12 @@ enable_queue = True
|
|
198 |
iface = gr.Interface(fn=process_input, inputs=gr.inputs.Image(type='filepath'), outputs=gr.outputs.Label(num_top_classes=3), examples = examples,
|
199 |
title=title, description=description,article=article,interpretation=interpretation, enable_queue=enable_queue
|
200 |
)
|
201 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
print(probs)
|
175 |
print(idxs)
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
return { idxs : float(probs) }
|
178 |
|
179 |
#append to list to be returned at end
|
|
|
191 |
iface = gr.Interface(fn=process_input, inputs=gr.inputs.Image(type='filepath'), outputs=gr.outputs.Label(num_top_classes=3), examples = examples,
|
192 |
title=title, description=description,article=article,interpretation=interpretation, enable_queue=enable_queue
|
193 |
)
|
194 |
+
iface.launch()
|
195 |
+
|
196 |
+
# Swap class to index mapping with index to class mapping and then map the classes to flower category labels using the json file
|
197 |
+
#idx_to_class = {v: k for k, v in pretrained_model.class_to_idx.items()}
|
198 |
+
#with open('cat_to_name.json','r') as f:
|
199 |
+
# cat_to_name = json.load(f)
|
200 |
+
#names = list(map(lambda x: cat_to_name[f"{idx_to_class[x]}"],idxs))
|
201 |
+
#return names, probs
|
202 |
+
#return { idxs[i].item() : float(probs[i].item()) for i in range(len(idxs))}
|