pierrequereuil commited on
Commit
1cd52d5
·
verified ·
1 Parent(s): 4d28120

Upload folder using huggingface_hub

Browse files
Files changed (9) hide show
  1. .gitattributes +1 -0
  2. .gitignore +2 -0
  3. README.md +2 -8
  4. app.py +40 -0
  5. assets/klay.jpeg +0 -0
  6. assets/pierre.png +3 -0
  7. models/classify.pt +3 -0
  8. models/pose.pt +3 -0
  9. requirements.txt +69 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ assets/pierre.png filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ env
2
+ node_modules
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: Basketball Classify
3
- emoji: 😻
4
- colorFrom: gray
5
- colorTo: gray
6
  sdk: gradio
7
  sdk_version: 4.42.0
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: basketball-classify
3
+ app_file: app.py
 
 
4
  sdk: gradio
5
  sdk_version: 4.42.0
 
 
6
  ---
 
 
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import PIL.Image as Image
3
+ from ultralytics import YOLO
4
+
5
+ classify = YOLO("models/classify.pt")
6
+
7
+
8
+ def predict(model, image, conf_threshold, iou_threshold, show=True):
9
+ results = model.predict(image, conf=conf_threshold, iou=iou_threshold)
10
+
11
+ for r in results:
12
+ im_array = r.plot(labels=show, boxes=show)
13
+ image = Image.fromarray(im_array[..., ::-1])
14
+
15
+ return image
16
+
17
+
18
+ def predict_image(image, conf_threshold, iou_threshold):
19
+ return predict(classify, image, conf_threshold, iou_threshold)
20
+
21
+
22
+ iface = gr.Interface(
23
+ fn=predict_image,
24
+ inputs=[
25
+ gr.Image(type="pil", label="Upload Image"),
26
+ gr.Slider(minimum=0, maximum=1, value=0.25,
27
+ label="Confidence threshold"),
28
+ gr.Slider(minimum=0, maximum=1, value=0.7, label="IoU threshold"),
29
+ ],
30
+ outputs=gr.Image(type="pil", label="Result"),
31
+ title="Basketball Classifier",
32
+ description="Have you ever wondered where the ball was when you were playing basketball? Where the rim was? Where you were?",
33
+ examples=[
34
+ ["assets/klay.jpeg", 0.25, 0.7],
35
+ ["assets/pierre.png", 0.25, 0.7],
36
+ ]
37
+ )
38
+
39
+ if __name__ == "__main__":
40
+ iface.launch()
assets/klay.jpeg ADDED
assets/pierre.png ADDED

Git LFS Details

  • SHA256: 325780567e3718e44b01a55a9eeb728dc59310353e4a39ce49f82f62141d726d
  • Pointer size: 132 Bytes
  • Size of remote file: 3.31 MB
models/classify.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e373e722941e5cd68e8918dd0bdaa121c378d7789a2af46f8b3a37fd5971f101
3
+ size 36618295
models/pose.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a14086802581046de9b39939924440523252cd5a47361081e802984ddf714ea1
3
+ size 89391502
requirements.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ annotated-types==0.7.0
3
+ anyio==4.4.0
4
+ certifi==2024.7.4
5
+ charset-normalizer==3.3.2
6
+ click==8.1.7
7
+ contourpy==1.3.0
8
+ cycler==0.12.1
9
+ fastapi==0.112.2
10
+ ffmpy==0.4.0
11
+ filelock==3.15.4
12
+ fonttools==4.53.1
13
+ fsspec==2024.6.1
14
+ gradio==4.42.0
15
+ gradio_client==1.3.0
16
+ h11==0.14.0
17
+ httpcore==1.0.5
18
+ httpx==0.27.2
19
+ huggingface-hub==0.24.6
20
+ idna==3.8
21
+ importlib_resources==6.4.4
22
+ Jinja2==3.1.4
23
+ kiwisolver==1.4.5
24
+ markdown-it-py==3.0.0
25
+ MarkupSafe==2.1.5
26
+ matplotlib==3.9.2
27
+ mdurl==0.1.2
28
+ mpmath==1.3.0
29
+ networkx==3.3
30
+ numpy==1.26.4
31
+ opencv-python==4.10.0.84
32
+ orjson==3.10.7
33
+ packaging==24.1
34
+ pandas==2.2.2
35
+ pillow==10.4.0
36
+ psutil==6.0.0
37
+ py-cpuinfo==9.0.0
38
+ pydantic==2.8.2
39
+ pydantic_core==2.20.1
40
+ pydub==0.25.1
41
+ Pygments==2.18.0
42
+ pyparsing==3.1.4
43
+ python-dateutil==2.9.0.post0
44
+ python-multipart==0.0.9
45
+ pytz==2024.1
46
+ PyYAML==6.0.2
47
+ requests==2.32.3
48
+ rich==13.8.0
49
+ ruff==0.6.2
50
+ scipy==1.14.1
51
+ seaborn==0.13.2
52
+ semantic-version==2.10.0
53
+ shellingham==1.5.4
54
+ six==1.16.0
55
+ sniffio==1.3.1
56
+ starlette==0.38.2
57
+ sympy==1.13.2
58
+ tomlkit==0.12.0
59
+ torch==2.4.0
60
+ torchvision==0.19.0
61
+ tqdm==4.66.5
62
+ typer==0.12.5
63
+ typing_extensions==4.12.2
64
+ tzdata==2024.1
65
+ ultralytics==8.2.83
66
+ ultralytics-thop==2.0.5
67
+ urllib3==2.2.2
68
+ uvicorn==0.30.6
69
+ websockets==12.0