Spaces:
Runtime error
Runtime error
hiraltalsaniya
commited on
Commit
•
d668599
1
Parent(s):
26dcb75
Update app.py
Browse files
app.py
CHANGED
@@ -3,14 +3,13 @@ import gradio as gr
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from PIL import Image
|
5 |
|
6 |
-
REPO_ID = "
|
7 |
FILENAME = "best.pt"
|
8 |
|
9 |
|
10 |
yolov7_custom_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
11 |
|
12 |
-
model = torch.hub.load('Owaiskhan9654/yolov7-1:main',model='custom', path_or_model=yolov7_custom_weights, force_reload=True)
|
13 |
-
|
14 |
def object_detection(im, size=416):
|
15 |
results = model(im)
|
16 |
results.render()
|
@@ -21,21 +20,14 @@ title = "Yolov7 Custom"
|
|
21 |
image = gr.inputs.Image(shape=(416, 416), image_mode="RGB", source="upload", label="Upload Image", optional=False)
|
22 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
23 |
|
24 |
-
Custom_description="
|
25 |
|
26 |
Footer = (
|
27 |
-
"
|
28 |
-
|
29 |
-
"<center> Model Trained Kaggle Kernel <a href=\"https://www.kaggle.com/code/owaiskhan9654/training-yolov7-on-kaggle-on-custom-dataset/notebook\">Link</a> <br></center>"
|
30 |
-
|
31 |
-
"<center> Kaggle Profile <a href=\"https://www.kaggle.com/owaiskhan9654\">Link</a> <br> </center>"
|
32 |
-
|
33 |
-
"<center> HuggingFace🤗 Model Deployed Repository <a href=\"https://huggingface.co/owaiskha9654/Yolov7_Custom_Object_Detection\">Link</a> <br></center>"
|
34 |
-
)
|
35 |
|
36 |
examples1=[["Image1.jpeg"],["Image2.jpeg"],["Image3.jpeg"],["Image4.jpeg"],["Image5.jpeg"],["Image6.jpeg"],["horses.jpeg"],["horses.jpeg"]]
|
37 |
|
38 |
-
Top_Title="<center>Yolov7 🚀 Custom Trained
|
39 |
css = ".output-image, .input-image {height: 50rem !important; width: 100% !important;}"
|
40 |
css = ".image-preview {height: auto !important;}"
|
41 |
|
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from PIL import Image
|
5 |
|
6 |
+
REPO_ID = "hiraltalsaniya/YOLOv7"
|
7 |
FILENAME = "best.pt"
|
8 |
|
9 |
|
10 |
yolov7_custom_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
11 |
|
12 |
+
model = torch.hub.load('Owaiskhan9654/yolov7-1:main',model='custom', path_or_model=yolov7_custom_weights, force_reload=True)
|
|
|
13 |
def object_detection(im, size=416):
|
14 |
results = model(im)
|
15 |
results.render()
|
|
|
20 |
image = gr.inputs.Image(shape=(416, 416), image_mode="RGB", source="upload", label="Upload Image", optional=False)
|
21 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
22 |
|
23 |
+
Custom_description="Custom Training Performed on colab style='text-decoration: underline' target='_blank'>Link</a> </center><br> <center>Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors </center> <br> <b>1st</b> class is for Person Detected<br><b>2nd</b> class is for Car Detected"
|
24 |
|
25 |
Footer = (
|
26 |
+
"MOdel train on our custome dataset")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
examples1=[["Image1.jpeg"],["Image2.jpeg"],["Image3.jpeg"],["Image4.jpeg"],["Image5.jpeg"],["Image6.jpeg"],["horses.jpeg"],["horses.jpeg"]]
|
29 |
|
30 |
+
Top_Title="<center>Yolov7 🚀 Custom Trained style='text-decoration: underline' target='_blank'></center></a>Face with mask and face without mask Detection"
|
31 |
css = ".output-image, .input-image {height: 50rem !important; width: 100% !important;}"
|
32 |
css = ".image-preview {height: auto !important;}"
|
33 |
|