nakamura196 commited on
Commit
e40a6f6
·
1 Parent(s): 705d051

feat: update gradio

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +1 -7
  3. requirements.txt +2 -1
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🌍
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.8.0
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.44.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -10,12 +10,8 @@ def yolo(im):
10
  results = model(im) # inference
11
 
12
  df = results.pandas().xyxy[0].to_json(orient="records")
13
- res = json.loads(df)
14
 
15
- im_with_boxes = results.render()[0] # results.render() returns a list of images
16
-
17
- # Convert the numpy array back to an image
18
- output_image = Image.fromarray(im_with_boxes)
19
 
20
  draw = ImageDraw.Draw(im)
21
 
@@ -27,7 +23,6 @@ def yolo(im):
27
  draw.rectangle([xmin, ymin, xmax, ymax], outline="red", width=3)
28
 
29
  return [
30
- output_image,
31
  res,
32
  im,
33
  ]
@@ -35,7 +30,6 @@ def yolo(im):
35
 
36
  inputs = gr.Image(type='pil', label="Original Image")
37
  outputs = [
38
- gr.Image(type="pil", label="Output Image"),
39
  gr.JSON(label="Output JSON"),
40
  gr.Image(type='pil', label="Output Image with Boxes"),
41
  ]
 
10
  results = model(im) # inference
11
 
12
  df = results.pandas().xyxy[0].to_json(orient="records")
 
13
 
14
+ res = json.loads(df)
 
 
 
15
 
16
  draw = ImageDraw.Draw(im)
17
 
 
23
  draw.rectangle([xmin, ymin, xmax, ymax], outline="red", width=3)
24
 
25
  return [
 
26
  res,
27
  im,
28
  ]
 
30
 
31
  inputs = gr.Image(type='pil', label="Original Image")
32
  outputs = [
 
33
  gr.JSON(label="Output JSON"),
34
  gr.Image(type='pil', label="Output Image with Boxes"),
35
  ]
requirements.txt CHANGED
@@ -1 +1,2 @@
1
- yolov5
 
 
1
+ yolov5
2
+ gradio