lterriel commited on
Commit
68c1e28
·
1 Parent(s): 4050d55

add images examples

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ 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
+ *.jpg filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ venv/
2
+ flagged/
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
.idea/YOLOv5_medieval_register.iml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/venv" />
6
+ </content>
7
+ <orderEntry type="inheritedJdk" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ <component name="PyDocumentationSettings">
11
+ <option name="format" value="PLAIN" />
12
+ <option name="myDocStringFormat" value="Plain" />
13
+ </component>
14
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
5
+ <Languages>
6
+ <language minSize="85" name="Python" />
7
+ </Languages>
8
+ </inspection_tool>
9
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
10
+ <inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
11
+ </profile>
12
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (YOLOv5_medieval_register)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/YOLOv5_medieval_register.iml" filepath="$PROJECT_DIR$/.idea/YOLOv5_medieval_register.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
__pycache__/app.cpython-38.pyc ADDED
Binary file (2.25 kB). View file
 
app.py CHANGED
@@ -1,17 +1,17 @@
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
12
  import yolov5
13
  from PIL import Image
14
- import torch
15
  from huggingface_hub import hf_hub_download
16
 
17
  # Add new models here
@@ -33,22 +33,21 @@ def yolo_inference(im, model_path, threshold=0.50):
33
  return output_image
34
 
35
  title = "YOLOv5 - Medieval Register Segmentation"
36
-
37
- #examples = [['', 0.50],
38
- # ['', 0.50],
39
- # ['', 0.50]]
40
 
41
  inputs = [gr.Image(type="pil", label="document image"),
42
- gr.inputs.Dropdown(model_names, label="Model"),
43
  gr.Slider(maximum=1, step=0.01, value=0.50)]
44
 
 
 
45
  demo=gr.Interface(fn=yolo_inference,
46
  inputs=inputs,
47
  outputs=gr.Image(type="pil", label="annotated document").style(height=800),
48
  title=title,
49
- #examples=examples,
50
- theme="huggingface")
51
-
52
 
53
  if __name__ == "__main__":
54
  demo.launch(debug=True)
 
1
  """
2
+ Gradio APP for Yolov5 medival registers layout analysis.
3
 
4
  Date: 20/12/2022
5
  Author: lterriel
6
 
7
+ * Gradio app adapted from HugoSchtr/DataCat_Yolov5
 
8
  """
9
+ import glob
10
 
11
  import gradio as gr
12
  import yolov5
13
  from PIL import Image
14
+ # import torch
15
  from huggingface_hub import hf_hub_download
16
 
17
  # Add new models here
 
33
  return output_image
34
 
35
  title = "YOLOv5 - Medieval Register Segmentation"
36
+ description = "<h5 style='text-align: center;'>YOLOv5 Gradio demo for medieval register layout analysis.</h3><br><ul><li>YOLOv5 source code : <a href='https://github.com/ultralytics/yolov5'>Source code</a></li><li>The examples provided are digitized images extracted from the <i>registers of the chapter of Notre-Dame (1326-1504)</i> available on the <a href='https://www.siv.archives-nationales.culture.gouv.fr/siv/rechercheconsultation/consultation/ir/consultationIR.action?irId=FRAN_IR_059635' target='_blank'>SIV of the National Archives of France</li></ul>"
 
 
 
37
 
38
  inputs = [gr.Image(type="pil", label="document image"),
39
+ gr.inputs.Dropdown(model_names, label="Model", default=model_names[0]),
40
  gr.Slider(maximum=1, step=0.01, value=0.50)]
41
 
42
+ examples = [[file, "0.50"] for file in glob.glob("./images_examples/*.jpg")]
43
+
44
  demo=gr.Interface(fn=yolo_inference,
45
  inputs=inputs,
46
  outputs=gr.Image(type="pil", label="annotated document").style(height=800),
47
  title=title,
48
+ description=description,
49
+ theme="huggingface",
50
+ examples=examples)
51
 
52
  if __name__ == "__main__":
53
  demo.launch(debug=True)
images_examples/FRAN_0393_05211_L.jpg ADDED

Git LFS Details

  • SHA256: 38a8432f69ea4f377611c5dd494d92028a7140bdad160d43fcc39707f841d6ce
  • Pointer size: 132 Bytes
  • Size of remote file: 1.34 MB
images_examples/FRAN_0393_05214_L.jpg ADDED

Git LFS Details

  • SHA256: 680a2f30a4b010717421c64423663dca4359433a34a7027976c660b928046adc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.46 MB
images_examples/FRAN_0393_05220_L.jpg ADDED

Git LFS Details

  • SHA256: b475b2f1aed61fd587d00e241095f8c14093a9f1c21bffb5b77dbf1e74594aa5
  • Pointer size: 132 Bytes
  • Size of remote file: 1.48 MB
images_examples/FRAN_0393_05223_L.jpg ADDED

Git LFS Details

  • SHA256: ccd00886e7cf8c0cc2eb8a53c34424c78976e6c44aabd984c349c1d72192b131
  • Pointer size: 132 Bytes
  • Size of remote file: 1.24 MB
images_examples/FRAN_0393_05228_L.jpg ADDED

Git LFS Details

  • SHA256: 01eb0bc317dc80e3a5fb2dc55794fef99904ba7105c738175080540b8cb2081f
  • Pointer size: 132 Bytes
  • Size of remote file: 1.56 MB