Spaces:
Runtime error
Runtime error
bonosa
commited on
Commit
Β·
a506ff4
1
Parent(s):
3db40fb
work damn you!
Browse files
app.py
CHANGED
|
@@ -2,11 +2,15 @@
|
|
| 2 |
from fastai.vision.all import load_learner, PILImage
|
| 3 |
|
| 4 |
import gradio
|
| 5 |
-
from gradio.
|
| 6 |
-
from gradio.outputs import *
|
| 7 |
from gradio import Interface, File
|
| 8 |
import traceback
|
| 9 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def exception_handler(type, value, tb):
|
| 12 |
print("".join(traceback.format_exception(type, value, tb)))
|
|
@@ -19,8 +23,9 @@ def predict_parrot_species(image):
|
|
| 19 |
pred, _, _ = learn_inf.predict(image)
|
| 20 |
return pred
|
| 21 |
|
| 22 |
-
input_image =
|
| 23 |
-
output_label =
|
| 24 |
|
| 25 |
gr_interface = gradio.Interface(fn=predict_parrot_species, inputs=input_image, outputs=output_label)
|
| 26 |
gr_interface = gradio.Interface(fn=predict_parrot_species, inputs=input_image, outputs=output_label)
|
|
|
|
|
|
| 2 |
from fastai.vision.all import load_learner, PILImage
|
| 3 |
|
| 4 |
import gradio
|
| 5 |
+
from gradio.components import Image, Label
|
|
|
|
| 6 |
from gradio import Interface, File
|
| 7 |
import traceback
|
| 8 |
import sys
|
| 9 |
+
import pathlib
|
| 10 |
+
|
| 11 |
+
# Patch pathlib to use WindowsPath on Windows systems
|
| 12 |
+
if pathlib.Path == pathlib.WindowsPath:
|
| 13 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
| 14 |
|
| 15 |
def exception_handler(type, value, tb):
|
| 16 |
print("".join(traceback.format_exception(type, value, tb)))
|
|
|
|
| 23 |
pred, _, _ = learn_inf.predict(image)
|
| 24 |
return pred
|
| 25 |
|
| 26 |
+
input_image = Image(shape=(224, 224))
|
| 27 |
+
output_label =Label()
|
| 28 |
|
| 29 |
gr_interface = gradio.Interface(fn=predict_parrot_species, inputs=input_image, outputs=output_label)
|
| 30 |
gr_interface = gradio.Interface(fn=predict_parrot_species, inputs=input_image, outputs=output_label)
|
| 31 |
+
gr_interface.launch()
|