aiXpert commited on
Commit
397ebcc
ยท
1 Parent(s): b7896d8
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
- 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=['a.jpg', 'b.jpg', 'c.jpg', '1.jpg', '2.jpg', '4.jpg', '5.jpg', '6.jpg', '9.jpg'],
23
- enable_queue=True).launch()
 
 
 
 
 
 
 
 
 
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