Aditya9790 commited on
Commit
8524d61
·
1 Parent(s): 8c91daa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ import argparse
5
+ import time
6
+ from pathlib import Path
7
+
8
+ import cv2
9
+ import torch
10
+ import torch.backends.cudnn as cudnn
11
+ from numpy import random
12
+
13
+ from models.experimental import attempt_load
14
+ from utils.datasets import LoadStreams, LoadImages
15
+ from utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \
16
+ scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
17
+ from utils.plots import plot_one_box
18
+ from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
19
+ from PIL import Image
20
+
21
+ from huggingface_hub import hf_hub_download
22
+
23
+ def load_model(model_name):
24
+ model_path = hf_hub_download(repo_id=f"Yolov7/{model_name}", filename=f"{model_name}.pt")
25
+
26
+ return model_path
27
+
28
+
29
+ model_names = [
30
+ "yolov7",
31
+ "yolov7-e6e",
32
+ "yolov7-e6",
33
+ ]
34
+
35
+ models = {model_name: load_model(model_name) for model_name in model_names}
36
+
37
+