Thiago-Cerq commited on
Commit
799e3d0
·
1 Parent(s): 349c1a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -55
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from fastai.vision.all import *
3
  import skimage
4
 
5
- learn = load_learner('modelo18.pkl')
6
 
7
  labels = learn.dls.vocab
8
  def predict(img):
@@ -10,11 +10,11 @@ def predict(img):
10
  pred,pred_idx,probs = learn.predict(img)
11
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
 
13
- title = "Bleach - Qual potencial de guerra?"
14
  description = "Reconhecer os 5 Potenciais (Bleach)"
15
  examples = ['Aizen.jpg', 'Ichigo.jpg', 'Zaraki.jpg','Ichibe.jpg', 'Urahara.jpg']
16
- interpretation='default'
17
- enable_queue=True
18
 
19
  gr.Interface(fn=predict,
20
  inputs=gr.inputs.Image(shape=(512, 512)),
@@ -23,54 +23,4 @@ gr.Interface(fn=predict,
23
  description=description,
24
  examples=examples,
25
  interpretation=interpretation,
26
- enable_queue=enable_queue).launch()
27
-
28
- #////////////////////////////////////////////////////////////////////////////////////////////////
29
-
30
- learn02 = load_learner('modelo34.pkl')
31
-
32
- labels2 = learn.dls.vocab
33
- def predict(img):
34
- img = PILImage.create(img)
35
- pred,pred_idx,probs = learn.predict(img)
36
- return {labels2[i]: float(probs[i]) for i in range(len(labels2))}
37
-
38
- title2 = "Bleach - Qual potencial de guerra?"
39
- description2 = "Reconhecer os 5 Potenciais (Bleach)"
40
- examples2 = ['Aizen.jpg', 'Ichigo.jpg', 'Zaraki.jpg','Ichibe.jpg', 'Urahara.jpg']
41
- interpretation2='default'
42
- enable_queue2 = True
43
-
44
- gr.Interface2(fn=predict,
45
- inputs=gr.inputs.Image(shape=(512, 512)),
46
- outputs=gr.outputs.Label(num_top_classes=3),
47
- title=title2,
48
- description=description2,
49
- examples=examples2,
50
- interpretation=interpretation2,
51
- enable_queue=enable_queue2).launch()
52
-
53
- #////////////////////////////////////////////////////////////////////////////////////////////////
54
-
55
- learn03 = load_learner('modelo50.pkl')
56
-
57
- labels3 = learn.dls.vocab
58
- def predict(img):
59
- img = PILImage.create(img)
60
- pred,pred_idx,probs = learn.predict(img)
61
- return {labels3[i]: float(probs[i]) for i in range(len(labels3))}
62
-
63
- title3 = "Bleach - Qual potencial de guerra?"
64
- description3 = "Reconhecer os 5 Potenciais (Bleach)"
65
- examples3 = ['Aizen.jpg', 'Ichigo.jpg', 'Zaraki.jpg','Ichibe.jpg', 'Urahara.jpg']
66
- interpretation3='default'
67
- enable_queue3 = True
68
-
69
- gr.Interface3(fn=predict,
70
- inputs=gr.inputs.Image(shape=(512, 512)),
71
- outputs=gr.outputs.Label(num_top_classes=3),
72
- title=title3,
73
- description=description3,
74
- examples=examples3,
75
- interpretation=interpretation3,
76
- enable_queue=enable_queue3).launch()
 
2
  from fastai.vision.all import *
3
  import skimage
4
 
5
+ learn = load_learner('modelo50.pkl')
6
 
7
  labels = learn.dls.vocab
8
  def predict(img):
 
10
  pred,pred_idx,probs = learn.predict(img)
11
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
 
13
+ title = "Bleach - Qual potencial de guerra? - RestNet50"
14
  description = "Reconhecer os 5 Potenciais (Bleach)"
15
  examples = ['Aizen.jpg', 'Ichigo.jpg', 'Zaraki.jpg','Ichibe.jpg', 'Urahara.jpg']
16
+ interpretation ='default'
17
+ enable_queue = True
18
 
19
  gr.Interface(fn=predict,
20
  inputs=gr.inputs.Image(shape=(512, 512)),
 
23
  description=description,
24
  examples=examples,
25
  interpretation=interpretation,
26
+ enable_queue=enable_queue).launch()