lombardata
commited on
Commit
•
70151b2
1
Parent(s):
9e66188
Update app.py
Browse files
app.py
CHANGED
@@ -64,24 +64,11 @@ def predict(input_image):
|
|
64 |
result = {key: result[key] for key in result if result[key] > 0.5}
|
65 |
return result
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
'''
|
71 |
-
image_processor = AutoImageProcessor.from_pretrained(checkpoint_name)
|
72 |
-
# predict
|
73 |
-
inputs = image_processor(input_image, return_tensors="pt")
|
74 |
-
image = np.expand_dims(inputs, axis=0)
|
75 |
-
pred = model.predict(image, verbose=0)
|
76 |
-
pred = pred[0]
|
77 |
-
confidences = {classes_names[i]: round(float(pred[i]), 2) for i in range(50)}
|
78 |
-
return confidences
|
79 |
-
'''
|
80 |
-
|
81 |
gr.Interface(
|
82 |
fn=predict,
|
83 |
inputs=gr.Image(shape=(224, 224)),
|
84 |
-
outputs=gr.Label(num_top_classes=5),
|
|
|
85 |
examples=[
|
86 |
"Dalbergia oliveri.JPG",
|
87 |
"Eucalyptus.JPG",
|
|
|
64 |
result = {key: result[key] for key in result if result[key] > 0.5}
|
65 |
return result
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
gr.Interface(
|
68 |
fn=predict,
|
69 |
inputs=gr.Image(shape=(224, 224)),
|
70 |
+
#outputs=gr.Label(num_top_classes=5),
|
71 |
+
outputs="label",
|
72 |
examples=[
|
73 |
"Dalbergia oliveri.JPG",
|
74 |
"Eucalyptus.JPG",
|