Spaces:
Runtime error
Runtime error
AlshimaaGamalAlsaied
commited on
Commit
·
5996601
1
Parent(s):
cccbdff
commit
Browse files
app.py
CHANGED
|
@@ -1,60 +1,4 @@
|
|
| 1 |
-
# import gradio as gr
|
| 2 |
-
# import torch
|
| 3 |
-
# import yolov5
|
| 4 |
|
| 5 |
-
# # Images
|
| 6 |
-
# torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')
|
| 7 |
-
# torch.hub.download_url_to_file('https://raw.githubusercontent.com/WongKinYiu/yolov7/main/inference/images/image3.jpg', 'image3.jpg')
|
| 8 |
-
|
| 9 |
-
# def yolov5_inference(
|
| 10 |
-
# image: gr.inputs.Image = None,
|
| 11 |
-
# model_path: gr.inputs.Dropdown = None,
|
| 12 |
-
# image_size: gr.inputs.Slider = 640,
|
| 13 |
-
# conf_threshold: gr.inputs.Slider = 0.25,
|
| 14 |
-
# iou_threshold: gr.inputs.Slider = 0.45,
|
| 15 |
-
# ):
|
| 16 |
-
# """
|
| 17 |
-
# YOLOv5 inference function
|
| 18 |
-
# Args:
|
| 19 |
-
# image: Input image
|
| 20 |
-
# model_path: Path to the model
|
| 21 |
-
# image_size: Image size
|
| 22 |
-
# conf_threshold: Confidence threshold
|
| 23 |
-
# iou_threshold: IOU threshold
|
| 24 |
-
# Returns:
|
| 25 |
-
# Rendered image
|
| 26 |
-
# """
|
| 27 |
-
# model = yolov5.load(model_path, device="cpu")
|
| 28 |
-
# model.conf = conf_threshold
|
| 29 |
-
# model.iou = iou_threshold
|
| 30 |
-
# results = model([image], size=image_size)
|
| 31 |
-
# return results.render()[0]
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
# inputs = [
|
| 35 |
-
# gr.inputs.Image(type="pil", label="Input Image"),
|
| 36 |
-
# gr.inputs.Dropdown(["yolov5s.pt", "yolov5l.pt", "yolov5x.pt"], label="Model"),
|
| 37 |
-
# gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
|
| 38 |
-
# gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
| 39 |
-
# gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
|
| 40 |
-
# ]
|
| 41 |
-
|
| 42 |
-
# outputs = gr.outputs.Image(type="filepath", label="Output Image")
|
| 43 |
-
# title = "YOLOv5"
|
| 44 |
-
# description = "YOLOv5 is a family of object detection models pretrained on COCO dataset. This model is a pip implementation of the original YOLOv5 model."
|
| 45 |
-
|
| 46 |
-
# examples = [['zidane.jpg', 'yolov5s.pt', 640, 0.25, 0.45], ['image3.jpg', 'yolov5s.pt', 640, 0.25, 0.45]]
|
| 47 |
-
# demo_app = gr.Interface(
|
| 48 |
-
# fn=yolov5_inference,
|
| 49 |
-
# inputs=inputs,
|
| 50 |
-
# outputs=outputs,
|
| 51 |
-
# title=title,
|
| 52 |
-
# examples=examples,
|
| 53 |
-
# cache_examples=True,
|
| 54 |
-
# live=True,
|
| 55 |
-
# theme='huggingface',
|
| 56 |
-
# )
|
| 57 |
-
# demo_app.launch(debug=True, enable_queue=True)
|
| 58 |
import gradio as gr
|
| 59 |
import torch
|
| 60 |
import yolov5
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
import yolov5
|