Spaces:
Build error
Build error
| FROM python:3.10-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |
| ``` | |
| Click **Commit changes to main**. | |
| ## STEP 3 : Upload Small Model Files | |
| Click **Add file**. Click **Upload files**. | |
| Go to your Mac Downloads folder. Find and upload only these three small files. | |
| ``` | |
| fusion_model.pkl | |
| scaler.pkl | |
| char_to_idx.pkl | |
| ``` | |
| Click **Commit changes**. | |
| ## STEP 4 : Get Google Drive File IDs | |
| Open a new browser tab. Go to **drive.google.com**. Open the AdaptiveShield folder. Open the models folder inside it. | |
| Right click **bert_model.zip**. Click **Get link**. You will see a URL like this. | |
| ``` | |
| https://drive.google.com/file/d/1ABCxyz123456/view?usp=sharing | |
| ``` | |
| The File ID is the part between **/d/** and **/view**. In this example it is **1ABCxyz123456**. Copy it. | |
| Do the same for these files and copy each ID. | |
| ``` | |
| bert_model.zip copy file ID | |
| roberta_model.zip copy file ID | |
| cnn_model.zip copy file ID | |
| gnn_model.zip copy file ID | |
| ``` | |
| ## STEP 5 : Make Drive Files Publicly Accessible | |
| For the download to work each file must be accessible without login. For each of the four zip files do this. | |
| Right click the file. Click **Share**. Click **Change to anyone with the link**. Make sure it says **Viewer**. Click **Done**. | |
| Do this for all four zip files. | |
| ## STEP 6 : Add Secrets to Hugging Face Space | |
| Go back to your Space page. Click the **Settings** tab at the top. | |
| Scroll down until you see a section called **Variables and secrets**. | |
| Click **New secret**. Add these four secrets one by one. | |
| **Secret 1** | |
| ``` | |
| Name : BERT_FILE_ID | |
| Value : paste your bert_model.zip file ID here | |
| ``` | |
| **Secret 2** | |
| ``` | |
| Name : ROBERTA_FILE_ID | |
| Value : paste your roberta_model.zip file ID here | |
| ``` | |
| **Secret 3** | |
| ``` | |
| Name : CNN_FILE_ID | |
| Value : paste your cnn_model.zip file ID here | |
| ``` | |
| **Secret 4** | |
| ``` | |
| Name : GNN_FILE_ID | |
| Value : paste your gnn_model.zip file ID here | |
| ``` | |
| ## STEP 7 : Restart the Space | |
| After adding all four secrets go back to the main Space page. Click the three dots menu in the top right corner of the page. Click **Factory reboot**. | |
| The Space will restart and begin building. You will see a build log. It will show lines like these. | |
| ``` | |
| Installing packages... | |
| Downloading bert_model.zip... | |
| Downloading roberta_model.zip... | |
| Extracting models... | |
| BERT loaded. | |
| RoBERTa loaded. | |
| CNN loaded. | |
| GNN loaded. | |
| Fusion loaded. | |
| ``` | |
| This takes about 5 to 10 minutes. | |
| ## STEP 8 : Check if It is Running | |
| When the Space shows a green dot that says **Running** open a new browser tab and go to this URL. Replace prashanth135 with your username. | |
| ``` | |
| https://prashanth135-adaptiveshield.hf.space/health |