|
| 1 | +--- |
| 2 | +sidebar_position: 4 |
| 3 | +--- |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +# Make your Own Web Application with Hailo and Using Flask |
| 8 | + |
| 9 | +This tutorial walks you through setting up a Hailo-based web application using Flask. It covers installing necessary dependencies, setting up the environment, and running the server. Here’s a step-by-step breakdown: |
| 10 | + |
| 11 | +### Step 1: Update the System |
| 12 | + |
| 13 | +Open a terminal on your reComputer AI Box and run the following commands to update your system: |
| 14 | + |
| 15 | +``` |
| 16 | +sudo apt update |
| 17 | +sudo apt full-upgrade |
| 18 | +``` |
| 19 | +### Step 2: Set PCIe to Gen3 |
| 20 | + |
| 21 | +Follow the [tutorial](https://seeed-projects.github.io/Tutorial-of-AI-Kit-with-Raspberry-Pi-From-Zero-to-Hero/docs/Chapter_2-Configuring_the_RaspberryPi_Environment/Introduction_to_Hailo_in_Raspberry_Pi_Environment#installing-hailo-software-on-raspberry-pi-5) to set PCIe to Gen3 as required for the Hailo device. |
| 22 | + |
| 23 | +### Step 3: Install Dependencies for NPU |
| 24 | + |
| 25 | +``` |
| 26 | +sudo apt install hailo-all |
| 27 | +``` |
| 28 | + |
| 29 | +### Step 4: Set Up the Project Environment |
| 30 | + |
| 31 | +- **Create a New Directory** |
| 32 | + |
| 33 | +``` |
| 34 | +mkdir Hailo-Web-App |
| 35 | +cd Hailo-Web-App |
| 36 | +``` |
| 37 | +- **Create and Activate a Virtual Environment** |
| 38 | + |
| 39 | +``` |
| 40 | +python -m venv --system-site-packages env |
| 41 | +source env/bin/activate |
| 42 | +
|
| 43 | +``` |
| 44 | +- **Clone the Repository** |
| 45 | + |
| 46 | +``` |
| 47 | +git clone https://github.com/KasunThushara/Hailo-Web.git |
| 48 | +cd Hailo-Web |
| 49 | +``` |
| 50 | + |
| 51 | +- **Install Python Dependencies** |
| 52 | + |
| 53 | +``` |
| 54 | +pip install -r requirements.txt |
| 55 | +``` |
| 56 | +- **Grant Execution Permission to the Download Script** |
| 57 | + |
| 58 | +``` |
| 59 | +chmod +x download_resources.sh |
| 60 | +``` |
| 61 | + |
| 62 | +- **Run the Resource Download Script** |
| 63 | + |
| 64 | +``` |
| 65 | +./download_resources.sh |
| 66 | +``` |
| 67 | + |
| 68 | +### Step 5: Start the Server |
| 69 | + |
| 70 | +- **Navigate Back to the Project Directory at New Terminal** |
| 71 | + |
| 72 | +``` |
| 73 | +cd ../Hailo-Web-App |
| 74 | +``` |
| 75 | + |
| 76 | +- **Activate the Virtual Environment (if not already activated)** |
| 77 | + |
| 78 | +``` |
| 79 | +source env/bin/activate |
| 80 | +``` |
| 81 | + |
| 82 | +- **Navigate to the Hailo-Web Directory** |
| 83 | + |
| 84 | +``` |
| 85 | +cd Hailo-Web |
| 86 | +``` |
| 87 | + |
| 88 | +- **Start the Server** |
| 89 | + |
| 90 | +``` |
| 91 | +python3 server.py |
| 92 | +
|
| 93 | +``` |
| 94 | + |
| 95 | +### Step 6: Access the Web UI |
| 96 | + |
| 97 | +Once the server is running, open a web browser and visit: |
| 98 | + |
| 99 | +``` |
| 100 | +http://<pi-ip-address>:5000 |
| 101 | +``` |
| 102 | + |
| 103 | +### What You Will Do on the Web UI: |
| 104 | +- Choose the vision task (e.g., object detection, pose estimation). |
| 105 | +- Upload the relevant files for the selected task. |
| 106 | +- View the results directly on the web interface. |
| 107 | +This setup provides a user-friendly interface for interacting with the Hailo device for various vision tasks. |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
0 commit comments