stphtan94117 commited on
Commit
f4cdc36
1 Parent(s): 236d6d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -21,7 +21,7 @@ torch.hub.download_url_to_file(
21
 
22
  # Model
23
  # model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update
24
- model = torch.hub.load('./yolov5', 'custom', path='plate.pt', source="local")
25
 
26
 
27
  def yolo(im):
@@ -36,7 +36,6 @@ def yolo(im):
36
  res = json.loads(df)
37
 
38
  return [Image.fromarray(results.ims[0]), res]
39
- # return [Image.fromarray(results.ims[0])]
40
 
41
 
42
 
@@ -45,11 +44,10 @@ def yolo(im):
45
  inputs = gr.inputs.Image(type='pil', label="Original Image")
46
  outputs = [gr.outputs.Image(type="pil", label="Output Image"),
47
  gr.outputs.JSON(label="Output JSON")]
48
- # outputs = gr.outputs.Image(type="pil", label="Output Image")
49
 
50
  title = "TW_plate_number"
51
  description = "TW_plate_number"
52
-
53
 
54
  examples = [['1.jpg'], ['2.jpg'], ['3.jpg'], ['4.jpg'], ['5.jpg'], ['6.jpg']]
55
- gr.Interface(yolo, inputs, outputs, title=title, description=description, examples=examples, theme="huggingface").launch(enable_queue=True)
 
21
 
22
  # Model
23
  # model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # force_reload=True to update
24
+ model = torch.hub.load('ultralytics/yolov5', 'custom', path='plate.pt', source="local")
25
 
26
 
27
  def yolo(im):
 
36
  res = json.loads(df)
37
 
38
  return [Image.fromarray(results.ims[0]), res]
 
39
 
40
 
41
 
 
44
  inputs = gr.inputs.Image(type='pil', label="Original Image")
45
  outputs = [gr.outputs.Image(type="pil", label="Output Image"),
46
  gr.outputs.JSON(label="Output JSON")]
 
47
 
48
  title = "TW_plate_number"
49
  description = "TW_plate_number"
50
+ # article = "<p style='text-align: center'>TW_plate_number <a href=\"http://codh.rois.ac.jp/char-shape/\">日本古典籍くずし字データセット</a>.</p>"
51
 
52
  examples = [['1.jpg'], ['2.jpg'], ['3.jpg'], ['4.jpg'], ['5.jpg'], ['6.jpg']]
53
+ gr.Interface(yolo, inputs, outputs, title=title, description=description, examples=examples, theme="huggingface").launch(enable_queue=True) # cache_examples=True,