Upload folder using huggingface_hub
Browse files- README.md +3 -7
- a.js +0 -0
- app.py +56 -0
- best (3).pt +3 -0
- requirements.txt +17 -0
README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title: 01
|
| 3 |
-
emoji: 🐠
|
| 4 |
-
colorFrom: yellow
|
| 5 |
-
colorTo: green
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.16.0
|
| 8 |
app_file: app.py
|
| 9 |
-
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: '01'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
app_file: app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 3.44.4
|
| 6 |
---
|
| 7 |
|
| 8 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
a.js
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
import cv2
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
import matplotlib.patches as patches
|
| 6 |
+
import numpy as np
|
| 7 |
+
import gradio as gr
|
| 8 |
+
|
| 9 |
+
model = YOLO('best (3).pt')
|
| 10 |
+
|
| 11 |
+
def index(img_url):
|
| 12 |
+
response = requests.get(img_url, stream=True)
|
| 13 |
+
img_array = np.asarray(bytearray(response.content), dtype=np.uint8)
|
| 14 |
+
img = cv2.imdecode(img_array, cv2.IMREAD_COLOR)
|
| 15 |
+
|
| 16 |
+
print(img_url)
|
| 17 |
+
|
| 18 |
+
classes_ = {0: 'noti', 1: 'pop'}
|
| 19 |
+
|
| 20 |
+
results = model.predict(source=img, conf = 0.7)
|
| 21 |
+
|
| 22 |
+
boxes = results[0].boxes.xyxy.tolist()
|
| 23 |
+
classes = results[0].boxes.cls.tolist()
|
| 24 |
+
names = results[0].names
|
| 25 |
+
confidences = results[0].boxes.conf.tolist()
|
| 26 |
+
|
| 27 |
+
print(boxes)
|
| 28 |
+
print(classes)
|
| 29 |
+
print(names)
|
| 30 |
+
print(confidences)
|
| 31 |
+
|
| 32 |
+
result_dict = {"boxes": boxes, "classes": classes, "names": names, "confidence": confidences}
|
| 33 |
+
|
| 34 |
+
return result_dict
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
inputs_image_url = [
|
| 38 |
+
gr.Textbox(type="text", label="Image URL"),
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
outputs_result_dict = [
|
| 42 |
+
gr.Textbox(type="text", label="Result Dictionary"),
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
interface_image_url = gr.Interface(
|
| 46 |
+
fn=index,
|
| 47 |
+
inputs=inputs_image_url,
|
| 48 |
+
outputs=outputs_result_dict,
|
| 49 |
+
title="Popup detection",
|
| 50 |
+
cache_examples=False,
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
gr.TabbedInterface(
|
| 54 |
+
[interface_image_url],
|
| 55 |
+
tab_names=['Image inference']
|
| 56 |
+
).queue().launch(share=True)
|
best (3).pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea96187ab41db4d90757f82a2f4435f4a233c207a316fe9a0a73fcda3501306b
|
| 3 |
+
size 22550041
|
requirements.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
flask-mongoengine @ git+https://github.com/idoshr/flask-mongoengine.git@e244408acf440c4208f7ddcd6e5d819cb472e4da
|
| 2 |
+
flask
|
| 3 |
+
requests
|
| 4 |
+
datetime
|
| 5 |
+
pandas
|
| 6 |
+
numpy
|
| 7 |
+
gensim
|
| 8 |
+
requests
|
| 9 |
+
bs4
|
| 10 |
+
tensorflow
|
| 11 |
+
ultralytics
|
| 12 |
+
opencv-python
|
| 13 |
+
matplotlib
|
| 14 |
+
gunicorn
|
| 15 |
+
gevent
|
| 16 |
+
streamlit
|
| 17 |
+
gradio
|