hysts HF staff commited on
Commit
f0b7f4a
1 Parent(s): 0a214bd
.gitattributes CHANGED
@@ -26,3 +26,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
26
  *.zip filter=lfs diff=lfs merge=lfs -text
27
  *.zstandard filter=lfs diff=lfs merge=lfs -text
28
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
26
  *.zip filter=lfs diff=lfs merge=lfs -text
27
  *.zstandard filter=lfs diff=lfs merge=lfs -text
28
  *tfevents* filter=lfs diff=lfs merge=lfs -text
29
+ *.jpg filter=lfs diff=lfs merge=lfs -text
.gitignore DELETED
@@ -1 +0,0 @@
1
- images
 
 
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 👁
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.19.1
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.36.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -2,20 +2,9 @@
2
 
3
  from __future__ import annotations
4
 
5
- import os
6
  import pathlib
7
- import shlex
8
- import subprocess
9
- import tarfile
10
-
11
- if os.environ.get('SYSTEM') == 'spaces':
12
- subprocess.call(shlex.split('pip uninstall -y opencv-python'))
13
- subprocess.call(shlex.split('pip uninstall -y opencv-python-headless'))
14
- subprocess.call(
15
- shlex.split('pip install opencv-python-headless==4.5.5.64'))
16
 
17
  import gradio as gr
18
- import huggingface_hub
19
  import mediapipe as mp
20
  import numpy as np
21
 
@@ -26,24 +15,6 @@ mp_pose = mp.solutions.pose
26
  TITLE = 'MediaPipe Human Pose Estimation'
27
  DESCRIPTION = 'https://google.github.io/mediapipe/'
28
 
29
- HF_TOKEN = os.getenv('HF_TOKEN')
30
-
31
-
32
- def load_sample_images() -> list[pathlib.Path]:
33
- image_dir = pathlib.Path('images')
34
- if not image_dir.exists():
35
- image_dir.mkdir()
36
- dataset_repo = 'hysts/input-images'
37
- filenames = ['002.tar']
38
- for name in filenames:
39
- path = huggingface_hub.hf_hub_download(dataset_repo,
40
- name,
41
- repo_type='dataset',
42
- use_auth_token=HF_TOKEN)
43
- with tarfile.open(path) as f:
44
- f.extractall(image_dir.as_posix())
45
- return sorted(image_dir.rglob('*.jpg'))
46
-
47
 
48
  def run(image: np.ndarray, model_complexity: int, enable_segmentation: bool,
49
  min_detection_confidence: float, background_color: str) -> np.ndarray:
@@ -82,10 +53,9 @@ def run(image: np.ndarray, model_complexity: int, enable_segmentation: bool,
82
  model_complexities = list(range(3))
83
  background_colors = ['white', 'black', 'green']
84
 
85
- image_paths = load_sample_images()
86
- examples = [[
87
- path.as_posix(), model_complexities[1], True, 0.5, background_colors[0]
88
- ] for path in image_paths]
89
 
90
  gr.Interface(
91
  fn=run,
@@ -95,7 +65,7 @@ gr.Interface(
95
  choices=model_complexities,
96
  type='index',
97
  value=model_complexities[1]),
98
- gr.Checkbox(default=True, label='Enable Segmentation'),
99
  gr.Slider(label='Minimum Detection Confidence',
100
  minimum=0,
101
  maximum=1,
@@ -106,8 +76,8 @@ gr.Interface(
106
  type='value',
107
  value=background_colors[0]),
108
  ],
109
- outputs=gr.Image(label='Output', type='numpy'),
110
  examples=examples,
111
  title=TITLE,
112
  description=DESCRIPTION,
113
- ).launch(show_api=False)
 
2
 
3
  from __future__ import annotations
4
 
 
5
  import pathlib
 
 
 
 
 
 
 
 
 
6
 
7
  import gradio as gr
 
8
  import mediapipe as mp
9
  import numpy as np
10
 
 
15
  TITLE = 'MediaPipe Human Pose Estimation'
16
  DESCRIPTION = 'https://google.github.io/mediapipe/'
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  def run(image: np.ndarray, model_complexity: int, enable_segmentation: bool,
20
  min_detection_confidence: float, background_color: str) -> np.ndarray:
 
53
  model_complexities = list(range(3))
54
  background_colors = ['white', 'black', 'green']
55
 
56
+ image_paths = sorted(pathlib.Path('images').rglob('*.jpg'))
57
+ examples = [[path, model_complexities[1], True, 0.5, background_colors[0]]
58
+ for path in image_paths]
 
59
 
60
  gr.Interface(
61
  fn=run,
 
65
  choices=model_complexities,
66
  type='index',
67
  value=model_complexities[1]),
68
+ gr.Checkbox(label='Enable Segmentation', value=True),
69
  gr.Slider(label='Minimum Detection Confidence',
70
  minimum=0,
71
  maximum=1,
 
76
  type='value',
77
  value=background_colors[0]),
78
  ],
79
+ outputs=gr.Image(label='Output', height=500),
80
  examples=examples,
81
  title=TITLE,
82
  description=DESCRIPTION,
83
+ ).queue().launch()
images/pexels-allan-mas-5368927.jpg ADDED

Git LFS Details

  • SHA256: 1f7e71063ae685ce07e852d865214ab953f3a7ac177d0b7aef1b871e050f153f
  • Pointer size: 132 Bytes
  • Size of remote file: 1.29 MB
images/pexels-allan-mas-5368976.jpg ADDED

Git LFS Details

  • SHA256: e1fff29e72471249f8f7f6bcca616110e7ebde91ab348c249ccaeaf612f5a285
  • Pointer size: 132 Bytes
  • Size of remote file: 1.09 MB
images/pexels-ana-bregantin-1930364.jpg ADDED

Git LFS Details

  • SHA256: 645a3d7a1faa01a84e8757b16640ab16ba59e491e8f4628afb4c283e93ea8060
  • Pointer size: 131 Bytes
  • Size of remote file: 769 kB
images/pexels-anastasiya-gepp-4456142.jpg ADDED

Git LFS Details

  • SHA256: c4c2d18eac65bc5efdea5a3b82edf6690639bbd3a0d2d75043bc63a1779c9aae
  • Pointer size: 131 Bytes
  • Size of remote file: 465 kB
images/pexels-anastasiya-gepp-4456152.jpg ADDED

Git LFS Details

  • SHA256: 951fa56defaff817e84bfbe2873a2e6cb637f57b8184ad1aa429fdd6be87485f
  • Pointer size: 131 Bytes
  • Size of remote file: 450 kB
images/pexels-august-de-richelieu-4427813.jpg ADDED

Git LFS Details

  • SHA256: 8ac717e71960822105cf143dadd33dd1f64dcb3556facb8b95f7a16b56e58831
  • Pointer size: 131 Bytes
  • Size of remote file: 382 kB
images/pexels-cottonbro-5770445.jpg ADDED

Git LFS Details

  • SHA256: b4548cd4a16238f559a149670c6ad2606b3b2147c92e5a2a380dd12fd922f276
  • Pointer size: 131 Bytes
  • Size of remote file: 379 kB
images/pexels-cottonbro-5770708.jpg ADDED

Git LFS Details

  • SHA256: 951720e6bb6053756ef555e5fcae4b54927582c4974e5908ea1984a9f14d7843
  • Pointer size: 131 Bytes
  • Size of remote file: 478 kB
images/pexels-cottonbro-6800242.jpg ADDED

Git LFS Details

  • SHA256: 4c2d9b5c0d319b28b9a570448a808c406fd8ff1ee6c9b8e5bf498495ba718391
  • Pointer size: 131 Bytes
  • Size of remote file: 638 kB
images/pexels-dmitriy-ganin-9167601.jpg ADDED

Git LFS Details

  • SHA256: a252eb80d56dbcc617f9a95ffc1608b918c0fb6920b68f666645b8e379b50402
  • Pointer size: 131 Bytes
  • Size of remote file: 713 kB
images/pexels-haste-leart-v-690598.jpg ADDED

Git LFS Details

  • SHA256: 90009cbaceb3c3802d0df460862434e446e5cfad7892986444146ce73a02f61c
  • Pointer size: 131 Bytes
  • Size of remote file: 329 kB
images/pexels-jake-_sulli_-swoyer-5835863.jpg ADDED

Git LFS Details

  • SHA256: 29ced69fdd9e9423f1d75fae0642d44fa55dbe10a429f679e88a4605fe4d44c0
  • Pointer size: 131 Bytes
  • Size of remote file: 585 kB
images/pexels-jasmine-carter-812258.jpg ADDED

Git LFS Details

  • SHA256: 6781bc53cdacae742b514dec3794a5a31472744b24e01304f23737dc50927214
  • Pointer size: 132 Bytes
  • Size of remote file: 1.02 MB
images/pexels-jo-kassis-5567802.jpg ADDED

Git LFS Details

  • SHA256: c4b65df7e312c086b571143a6a7443c7873afa8a51ad1c1299223ce9f8a2ee57
  • Pointer size: 131 Bytes
  • Size of remote file: 319 kB
images/pexels-kaichieh-chan-917510.jpg ADDED

Git LFS Details

  • SHA256: 394c428578e1e919aa3c3905b6ea8d151669e1a7271ce45f68961c863a8688ee
  • Pointer size: 131 Bytes
  • Size of remote file: 681 kB
images/pexels-luis-gallegos-alvarez-1164975.jpg ADDED

Git LFS Details

  • SHA256: 05cb7605dbac48915eee1b6ef0de3aba386abb7ab06ef27d58c092df2c76a176
  • Pointer size: 131 Bytes
  • Size of remote file: 553 kB
images/pexels-lukas-rodriguez-3492736.jpg ADDED

Git LFS Details

  • SHA256: 48576b2149bb5e4258c4d0bcea19e37c5365413c8b7d63795102fdf0f7f94966
  • Pointer size: 131 Bytes
  • Size of remote file: 625 kB
images/pexels-martin-lopez-2240771.jpg ADDED

Git LFS Details

  • SHA256: 93ab345cfc87577ce8610d23d21ae2393e5db7f85d471cd2a5277f8f68d432bc
  • Pointer size: 131 Bytes
  • Size of remote file: 582 kB
images/pexels-mehmet-turgut-kirkgoz-11596703.jpg ADDED

Git LFS Details

  • SHA256: 4512c64b43e70adf13a7641d0a097ab7f99b801a71fc676c98a39c61d9508f3e
  • Pointer size: 131 Bytes
  • Size of remote file: 426 kB
images/pexels-nataliya-vaitkevich-4943547.jpg ADDED

Git LFS Details

  • SHA256: 3cdb6c92b9dc95e3c933e29f38a2f6ef4aa981b33625d329472f0d389d2ad594
  • Pointer size: 132 Bytes
  • Size of remote file: 1.1 MB
images/pexels-satoshi-hirayama-1325837.jpg ADDED

Git LFS Details

  • SHA256: 5ac7a2cff79c6e9174ed2b127f63886ed3e661c9fe85269d4cd00f07adc8236d
  • Pointer size: 131 Bytes
  • Size of remote file: 451 kB
images/pexels-victoria-borodinova-7909580.jpg ADDED

Git LFS Details

  • SHA256: c05ceaf9c468dd21d24977f2c50e3f3b9b1ba83474d93180f66496635216b573
  • Pointer size: 131 Bytes
  • Size of remote file: 279 kB
images/pexels-yan-krukov-5792907.jpg ADDED

Git LFS Details

  • SHA256: 0500121b9044cb1d4c7913e48ebe5e2374848d57d6a2905f3b7c9469f959f2fe
  • Pointer size: 131 Bytes
  • Size of remote file: 648 kB
images/pexels-yogendra-singh-1701195.jpg ADDED

Git LFS Details

  • SHA256: d4d2b51bd8db1b464512ea9d41debd666b81c1ce873febe7267c082b0dd2fe6c
  • Pointer size: 131 Bytes
  • Size of remote file: 152 kB
images/pexels-лиза-медведева-8574605.jpg ADDED

Git LFS Details

  • SHA256: 85cf4db499f0c5b11397af648e66178a4e40e6d478f1e6b31ade35e225ff6ceb
  • Pointer size: 131 Bytes
  • Size of remote file: 816 kB
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- mediapipe==0.8.9.1
2
- numpy==1.22.3
3
- opencv-python-headless==4.5.5.64
 
1
+ mediapipe==0.10.1
2
+ numpy==1.23.5
3
+ opencv-python-headless==4.8.0.74