lterriel commited on
Commit
7f46425
·
1 Parent(s): 4fce840

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,5 +1,11 @@
1
  """
2
- Inspired by HugoSchtr/DataCat_Yolov5
 
 
 
 
 
 
3
  """
4
 
5
  import gradio as gr
@@ -8,12 +14,13 @@ from PIL import Image
8
  import torch
9
  from huggingface_hub import hf_hub_download
10
 
 
11
  model_names = [
12
- "endp-yolov5x-35e-bs4",
13
  ]
14
 
15
  def load_model(model_name):
16
- model_path = hf_hub_download(repo_id=f"lterriel/{model_name}", filename="best.pt")
17
  return model_path
18
 
19
  def yolo_inference(im, model_path, threshold=0.50):
@@ -32,7 +39,7 @@ title = "YOLOv5 - Medieval Register Segmentation"
32
  # ['', 0.50]]
33
 
34
  inputs = [gr.Image(type="pil", label="document image"),
35
- gr.inputs.Dropdown(model_names, label="Model"),
36
  gr.Slider(maximum=1, step=0.01, value=0.50)]
37
 
38
  demo=gr.Interface(fn=yolo_inference,
 
1
  """
2
+ Gradio APP for Yolo segmentation model of medival registers.
3
+
4
+ Date: 20/12/2022
5
+ Author: lterriel
6
+
7
+ Test segmentation model with object-detection Yolo model
8
+ App inspired by HugoSchtr/DataCat_Yolov5
9
  """
10
 
11
  import gradio as gr
 
14
  import torch
15
  from huggingface_hub import hf_hub_download
16
 
17
+ # Add new models here
18
  model_names = [
19
+ "lterriel/endp-yolov5x-35e-bs4",
20
  ]
21
 
22
  def load_model(model_name):
23
+ model_path = hf_hub_download(repo_id=model_name, filename="best.pt")
24
  return model_path
25
 
26
  def yolo_inference(im, model_path, threshold=0.50):
 
39
  # ['', 0.50]]
40
 
41
  inputs = [gr.Image(type="pil", label="document image"),
42
+ gr.inputs.Dropdown(model_names, label="Model", value=model_names[0]),
43
  gr.Slider(maximum=1, step=0.01, value=0.50)]
44
 
45
  demo=gr.Interface(fn=yolo_inference,