hermanshid commited on
Commit
a2c6b4a
1 Parent(s): a6e5c37

initial space

Browse files
Files changed (5) hide show
  1. .gitattributes +5 -0
  2. README.md +3 -3
  3. app.py +38 -0
  4. requirements.txt +4 -0
  5. test_images/example1.jpg +3 -0
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ test_images/ filter=lfs diff=lfs merge=lfs -text
37
+ test_images/example2.jpg filter=lfs diff=lfs merge=lfs -text
38
+ test_images/example3.jpg filter=lfs diff=lfs merge=lfs -text
39
+ test_images/example1.jpg filter=lfs diff=lfs merge=lfs -text
40
+ install filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Yolo Layout Detector Space
3
- emoji: 🏆
4
  colorFrom: blue
5
- colorTo: purple
6
  sdk: gradio
7
  sdk_version: 3.44.4
8
  app_file: app.py
 
1
  ---
2
+ title: Layout Detector Space
3
+ emoji:
4
  colorFrom: blue
5
+ colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.44.4
8
  app_file: app.py
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ import yolov5
4
+ from PIL import Image
5
+
6
+ app_title = "Aksara Jawa Layout Detection"
7
+ models_id = 'hermanshid/yolo-layout-detector-space'
8
+
9
+ model = yolov5.load(models_id)
10
+
11
+ examples = [['test_images/example1.jpg', 0.6, ]]
12
+
13
+
14
+ def predict(image, threshold=0.25):
15
+ global models_id
16
+ global model
17
+
18
+ input_size = 640
19
+
20
+ model.conf = threshold
21
+ results = model(image, size=input_size)
22
+ numpy_image = results.render()[0]
23
+ output_image = Image.fromarray(numpy_image)
24
+ return output_image
25
+
26
+
27
+ gr.Interface(
28
+ title=app_title,
29
+ description="Created by 'hermanshid'",
30
+ fn=predict,
31
+ inputs=[
32
+ gr.Image(type="pil"),
33
+ gr.Slider(maximum=1, step=0.01, value=0.25),
34
+ ],
35
+ outputs=gr.Image(type="pil"),
36
+ examples=examples,
37
+ cache_examples=True if examples else False,
38
+ ).launch(enable_queue=True)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ yolov5==7.0.5
2
+ gradio==3.15.0
3
+ torch
4
+ huggingface-hub
test_images/example1.jpg ADDED

Git LFS Details

  • SHA256: 3520a56952cdd1bf057ab140d7400d4a49bdbea94b7d13e05c84e745cce25e73
  • Pointer size: 132 Bytes
  • Size of remote file: 1.25 MB