msibertman commited on
Commit
55d3e69
·
1 Parent(s): 8733ee9

image type change

Browse files
Files changed (3) hide show
  1. app.py +7 -3
  2. flagged/image/tmpphp290am.jpg +0 -0
  3. flagged/log.csv +2 -0
app.py CHANGED
@@ -1,6 +1,10 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
 
 
4
  cap_labels = (
5
  'balaclava cap',
6
  'baseball cap',
@@ -30,8 +34,8 @@ def recognize_image(image):
30
  pred, idx, probs = model.predict(image)
31
  return dict(zip(cap_labels, map(float, probs)))
32
 
33
- image = gr.inputs.Image(shape=(192,192))
34
- label = gr.outputs.Label()
35
  examples = [
36
  'test_images/unknown_00.jpg',
37
  'test_images/unknown_01.jpg',
@@ -40,4 +44,4 @@ examples = [
40
  ]
41
 
42
  iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
43
- iface.launch()
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ # import pathlib
5
+ # temp = pathlib.PosixPath
6
+ # pathlib.PosixPath = pathlib.WindowsPath
7
+
8
  cap_labels = (
9
  'balaclava cap',
10
  'baseball cap',
 
34
  pred, idx, probs = model.predict(image)
35
  return dict(zip(cap_labels, map(float, probs)))
36
 
37
+ image = gr.inputs.Image(type='pil', shape=(192,192))
38
+ label = gr.outputs.Label(num_top_classes=5)
39
  examples = [
40
  'test_images/unknown_00.jpg',
41
  'test_images/unknown_01.jpg',
 
44
  ]
45
 
46
  iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
47
+ iface.launch(inline=False)
flagged/image/tmpphp290am.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ image,output,flag,username,timestamp
2
+ F:\MasterCourse\Week 09 - End-to-end Data Science Pipeline in Practice\Lecture 34 - Deploy Model to HuggingFace Spaces\cap-recognizer\flagged\image\tmpphp290am.jpg,,,,2023-01-05 23:56:06.368167