Update app.py
Browse files
app.py
CHANGED
|
@@ -95,7 +95,10 @@ def process_image(img, generate_image=True):
|
|
| 95 |
predicted_class, _, probs = learn.predict(img)
|
| 96 |
print(f"Prediction complete: {predicted_class}")
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Get Wikipedia link
|
| 101 |
wiki_url = search_terms_wikipedia.get(predicted_class, "No Wikipedia entry found.")
|
|
@@ -163,8 +166,8 @@ with gr.Blocks() as demo:
|
|
| 163 |
examples=example_images,
|
| 164 |
inputs=input_image,
|
| 165 |
examples_per_page=6,
|
| 166 |
-
fn=
|
| 167 |
-
outputs=
|
| 168 |
)
|
| 169 |
|
| 170 |
input_image.change(
|
|
|
|
| 95 |
predicted_class, _, probs = learn.predict(img)
|
| 96 |
print(f"Prediction complete: {predicted_class}")
|
| 97 |
|
| 98 |
+
# Format classification results for Gradio Label
|
| 99 |
+
classification_results = {
|
| 100 |
+
predicted_class: float(probs[learn.dls.vocab.o2i[predicted_class]])
|
| 101 |
+
}
|
| 102 |
|
| 103 |
# Get Wikipedia link
|
| 104 |
wiki_url = search_terms_wikipedia.get(predicted_class, "No Wikipedia entry found.")
|
|
|
|
| 166 |
examples=example_images,
|
| 167 |
inputs=input_image,
|
| 168 |
examples_per_page=6,
|
| 169 |
+
fn=None,
|
| 170 |
+
outputs=None
|
| 171 |
)
|
| 172 |
|
| 173 |
input_image.change(
|