gradio
Browse files- app - Copy.py +23 -0
- app.py +20 -12
- 1.jpg โ jpg/1.jpg +0 -0
- 2.jpg โ jpg/2.jpg +0 -0
- 4.jpg โ jpg/4.jpg +0 -0
- 5.JPG โ jpg/5.JPG +0 -0
- 6.JPG โ jpg/6.JPG +0 -0
- 9.JPG โ jpg/9.JPG +0 -0
- BatchConvertWEBP2JPG.py โ jpg/BatchConvertWEBP2JPG.py +0 -0
- a.jpg โ jpg/a.jpg +0 -0
- b.jpg โ jpg/b.jpg +0 -0
- c.jpg โ jpg/c.jpg +0 -0
app - Copy.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import pathlib
|
| 4 |
+
|
| 5 |
+
plt = platform.system()
|
| 6 |
+
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
| 7 |
+
|
| 8 |
+
learn = load_learner('YomeRecognition.pkl')
|
| 9 |
+
|
| 10 |
+
labels = learn.dls.vocab # list of model classes
|
| 11 |
+
def predict(img):
|
| 12 |
+
img = PILImage.create(img)
|
| 13 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 14 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 15 |
+
|
| 16 |
+
gr.Interface(
|
| 17 |
+
fn=predict,
|
| 18 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
| 19 |
+
outputs=gr.outputs.Label(num_top_classes=5),
|
| 20 |
+
title="๐ Sugar ๐ถ Yome ๐ฆฎ Yang Chenchen ๐ Recognition ๐",
|
| 21 |
+
description="Classifier trainded on images of Yang Chenchen Yome, Wang Xinyao, and others. ",
|
| 22 |
+
examples=['jpg/a.jpg', 'jpg/b.jpg', 'jpg/c.jpg', 'jpg/1.jpg', 'jpg/2.jpg', 'jpg/4.jpg', 'jpg/5.jpg', 'jpg/6.jpg', 'jpg/9.jpg'],
|
| 23 |
+
enable_queue=True).launch()
|
app.py
CHANGED
|
@@ -8,16 +8,24 @@ if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
|
| 8 |
learn = load_learner('YomeRecognition.pkl')
|
| 9 |
|
| 10 |
labels = learn.dls.vocab # list of model classes
|
| 11 |
-
def predict(img):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
gr.Interface(
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
learn = load_learner('YomeRecognition.pkl')
|
| 9 |
|
| 10 |
labels = learn.dls.vocab # list of model classes
|
| 11 |
+
# def predict(img):
|
| 12 |
+
# img = PILImage.create(img)
|
| 13 |
+
# pred,pred_idx,probs = learn.predict(img)
|
| 14 |
+
# return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 15 |
|
| 16 |
+
# gr.Interface(
|
| 17 |
+
# fn=predict,
|
| 18 |
+
# inputs=gr.inputs.Image(shape=(512, 512)),
|
| 19 |
+
# outputs=gr.outputs.Label(num_top_classes=5),
|
| 20 |
+
# title="๐ Sugar ๐ถ Yome ๐ฆฎ Yang Chenchen ๐ Recognition ๐",
|
| 21 |
+
# description="Classifier trainded on images of Yang Chenchen Yome, Wang Xinyao, and others. ",
|
| 22 |
+
# examples=['jpg/a.jpg', 'jpg/b.jpg', 'jpg/c.jpg', 'jpg/1.jpg', 'jpg/2.jpg', 'jpg/4.jpg', 'jpg/5.jpg', 'jpg/6.jpg', 'jpg/9.jpg'],
|
| 23 |
+
# enable_queue=True).launch()
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def greet(name):
|
| 28 |
+
return "Hello " + name + "!!"
|
| 29 |
+
|
| 30 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 31 |
+
iface.launch()
|
1.jpg โ jpg/1.jpg
RENAMED
|
File without changes
|
2.jpg โ jpg/2.jpg
RENAMED
|
File without changes
|
4.jpg โ jpg/4.jpg
RENAMED
|
File without changes
|
5.JPG โ jpg/5.JPG
RENAMED
|
File without changes
|
6.JPG โ jpg/6.JPG
RENAMED
|
File without changes
|
9.JPG โ jpg/9.JPG
RENAMED
|
File without changes
|
BatchConvertWEBP2JPG.py โ jpg/BatchConvertWEBP2JPG.py
RENAMED
|
File without changes
|
a.jpg โ jpg/a.jpg
RENAMED
|
File without changes
|
b.jpg โ jpg/b.jpg
RENAMED
|
File without changes
|
c.jpg โ jpg/c.jpg
RENAMED
|
File without changes
|