A Beautiful Flask Web API for Yolov7 (and custom) models
A Beautiful Flask Web API for Yolov7 (and custom) models
Yolov7 Flask
A Beautiful Flask Framework for Implementing the Latest Yolov7 Model
I developed this API for the purpose of deploying my own Yolov7 model, which is a very accurate skin burn detector. For more information about that project please check out this repo:
https://github.com/Michael-OvO/Burn-Detection-Classification
To run this, please make sure you follow the following steps:
a trained Yolov7 model (or you can also use the official pretrained yolov7 models), they can be downloaded here.
Once you have downloaded files, proceed to the next step. The feature of this web app is that it does not require a specific model name, as I have written code to directly search for the model file that is inside this directory (so you do not need to modify anything and just run it). But do note that please just put one model file into your directory a single time, or else the code will not run properly. - the green bar on top of the page will display which model is currently being inferenced on your machine.
Make sure you have met the following requirements:
- PyTorch >= 1.6
- flask
- and dependencies required by Yolov7 (if you git cloned the original yolov7 repo then simply run pip install -r requirements.txt inside the yolov7 repo)
then, to launch the app, run the following command:
$ FLASK_ENV=development FLASK_APP=app.py flask runthen, visit http://localhost:5000/ in your browser.
choose some pictures that the model has been trained on and test it out!
I will be using yolov7-e6e.pt for this demo and I am currently working with a RTX 3070Ti.
My directory setup is like this:
Then running the app.py yields the following output:
(if it is first time running, it may take a while to download the original repo
…Then, simply control + click on the address will bring you to the flask app.
The original yolov7 pretrained weights was trained on MS COCO dataset, so it could recognize a dog:
Have fun using this framework!
(If there are requests to add these 2 features please let me know. I will consider adding it)
This framework was rewritten from this repo:
No open issues yet, or sync has not completed.