The task is to create an AI for the classification of traffic signs, the 'model' file is a ready trained model and the prediction is done in 'PublicAPI.py'.
The API itself is written in Python using the Flask framework
The API should receive an image of a road turn sign as input (it can consist of several signs) and send the name of the signs from left to right.
We will use our own computer as a server and ngrok as a proxy. ngrok - https://ngrok.com/download
With 'PublicAPI.py' we start a local server
if __name__ == "__main__":
app.run(host='0.0.0.0', port=4444)
Next, open ngrok.exe and run the proxy with the command: 'ngrok http your_port', in our case, our port is 4444, in response we will receive a lot of information, including the URL
Forwarding http://52b3-5-142-42-152.ngrok.io -> http://localhost:4444
We will check the functionality of the API using the 'TestPublicAPI.py' file, we send a request with a photo to the URL received from ngrok.
import requests
import json
files = {'file': open('TestImage.png','rb')}
print(requests.post('http://52b3-5-142-42-152.ngrok.io', files=files).text)
In response, we receive the directions of the signs
Прямо,Направо+Прямо