File size: 1,974 Bytes
e68321e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

# 🚀 YOLOv5 Streamlit Deployment
[![HitCount](https://hits.dwyl.com/thepbordin/YOLOv5-Streamlit-Deployment.svg?style=flat&show=unique)](http://hits.dwyl.com/thepbordin/YOLOv5-Streamlit-Deployment)


A Easy way to deploy [YOLOv5](https://github.com/ultralytics/yolov5) object detection model with [Streamlit](https://streamlit.io/). 

**Please feel free to use/edit.** 


code modified by GitHub/thepbordin from GitHub/zhoroh

## ✨ Features

- YOLO Weights Source
	-  Load from Local
	- Download Weights from URL
- Example Dataset 
  - Videos
  -	 Images
 - Upload Data 
   - Video
   - Image
- Select computing device (cuda/cpu)



## ⚙️ Installation



### Local Use
1. Install Requirements 
	`pip install -r requirements.txt`
2. Install ffmpeg (for video inferencing)
	- For Windows [read here](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/)
	- For Mac (brew)
		`brew install ffmpeg`
3. Strart Stremlit
	```
	cd YOLOv5-Streamlit-Deployment
    streamlit run app.py
    ```
### Streamlit Cloud
1. Edit a configuration in app.py (read ⚙️ Config Instruction)
2. (Optional) Upload example datas in
	- `example_images`
	- `example_videos`
4. Deploy on [Streamlit](https://share.streamlit.io/deploy)


## ⚙️ Config Instruction
### Download model from URL

1. Upload model to [Internet Archive](https://archive.org/)
2. Go to your uploaded file page.
3. From `DOWNLOAD OPTIONS` select `SHOW ALL`
4. Right click at <yourmodelname>.pt and Copy link address.
5. Edit config in [app.py](https://github.com/thepbordin/YOLOv5-Streamlit-Deployment/blob/main/app.py)

	```python
	cfg_enable_url_download = True
	url = "your_model_url"
	```

### Use local .pt file:
Edit config in [app.py](https://github.com/thepbordin/YOLOv5-Streamlit-Deployment/blob/main/app.py)
```python
## CFG
cfg_model_path = "models/your_model_name.pt" 
```

## Reference
[Yolov5 Real-time Inference using Streamlit](https://github.com/moaaztaha/Yolo-Interface-using-Streamlit)