stphtan94117 commited on
Commit
92cdde1
1 Parent(s): 4c82368

Upload 10 files

Browse files
Files changed (11) hide show
  1. .gitattributes +2 -0
  2. .gitignore +4 -0
  3. app.py +44 -0
  4. gitattributes.txt +35 -0
  5. requirements.txt +2 -0
  6. sample/1.jpg +3 -0
  7. sample/2.jpg +0 -0
  8. sample/3.jpg +0 -0
  9. sample/4.jpg +0 -0
  10. sample/5.jpg +0 -0
  11. sample/6.jpg +3 -0
.gitattributes CHANGED
@@ -32,3 +32,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ sample/1.jpg filter=lfs diff=lfs merge=lfs -text
36
+ sample/6.jpg filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ venv/
2
+ flagged/
3
+ .idea/
4
+ __pycache__/
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import glob
2
+
3
+ import gradio as gr
4
+ import yolov5
5
+ from PIL import Image
6
+ # import torch
7
+ from huggingface_hub import hf_hub_download
8
+
9
+ # Add new models here
10
+ model_names = [
11
+ "TW_plate_number",
12
+ ]
13
+
14
+ def load_model(model_name):
15
+ model_path = hf_hub_download(repo_id=model_name, filename="plate.pt")
16
+ return model_path
17
+
18
+ def yolo_inference(im, model_path, threshold=0.70):
19
+ model_loaded = load_model(model_path)
20
+ model = yolov5.load(model_loaded)
21
+ model.conf = threshold
22
+ results = model(im) # inference
23
+ numpy_image = results.render()[0]
24
+ output_image = Image.fromarray(numpy_image)
25
+ return output_image
26
+
27
+ title = "TW_plate_number"
28
+
29
+ inputs = [gr.Image(type="pil", label="document image"),
30
+ gr.inputs.Dropdown(model_names, label="Model", default=model_names[0]),
31
+ gr.Slider(maximum=1, step=0.01, value=0.70)]
32
+
33
+
34
+ examples = [[str(file),model_names[0], 0.70] for file in glob.glob("./sample/*.jpg")]
35
+
36
+ demo=gr.Interface(fn=yolo_inference,
37
+ inputs=inputs,
38
+ outputs=gr.Image(type="pil", label="annotated document").style(height=800),
39
+ title=title,
40
+ theme="huggingface",
41
+ examples=examples)
42
+
43
+ if __name__ == "__main__":
44
+ demo.launch(debug=True)
gitattributes.txt ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ *.jpg filter=lfs diff=lfs merge=lfs -text
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ yolov5==7.0.2
2
+ gradio
sample/1.jpg ADDED

Git LFS Details

  • SHA256: 06527d37e622c703acc67adc75a316a7bf9050cc42c80418e0a6e3c61d837d72
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
sample/2.jpg ADDED
sample/3.jpg ADDED
sample/4.jpg ADDED
sample/5.jpg ADDED
sample/6.jpg ADDED

Git LFS Details

  • SHA256: 6ee446aa4e4f9adc5d230cd915918bf9ad1525d74fd3d81a039bb5bec4f17465
  • Pointer size: 132 Bytes
  • Size of remote file: 1.92 MB