Spaces:
Sleeping
Sleeping
| title: HTS Review Tool | |
| sdk: streamlit | |
| emoji: ๐ | |
| colorFrom: blue | |
| colorTo: green | |
| # HTS Checker - Tariff Audit Tool | |
| A Streamlit application for auditing HTS (Harmonized Tariff Schedule) codes, validating primary HTS against additional tariffs and description keywords. | |
| ## Features | |
| - **Auto-validation**: Validation runs automatically when file is uploaded | |
| - **17 Scenarios**: Validates Steel, Aluminum, Copper tariff classifications | |
| - **Unique Combinations View**: De-duplicates entries by HTS+Description for efficient review | |
| - **Interactive Filters**: Filter by HTS, description, status, scenario | |
| - **Bulk Export**: Add filtered results to cache and export to Excel | |
| - **HTS Reference**: View all Steel/Aluminum/Copper HTS lists with overlap analysis | |
| - **Editable Keywords**: Customize metal, aluminum, copper, zinc, plastics keyword lists | |
| ## Validation Scenarios | |
| | ID | Description | | |
| |----|-------------| | |
| | S1 | Steel HTS + 232 tariff applied - verify 99030133 present, no 99030125 | | |
| | S2 | Metal keyword but NOT steel HTS - should apply 99030125, no 232 tariffs | | |
| | S4 | Aluminum HTS + 232 tariff applied - verify 99030133 present, no 99030125 | | |
| | S5 | Aluminum keyword but NOT aluminum HTS - should apply 99030125, no 232 tariffs | | |
| | S7 | Dual Steel+Aluminum HTS - matches keyword, apply corresponding 232, no 99030125 | | |
| | S7a | Dual Steel+Aluminum HTS + BOTH keywords - flag for manual review | | |
| | S8 | Dual Steel+Aluminum HTS + NO keywords - flag for manual review | | |
| | S9 | Copper keyword but NOT copper HTS - should apply 99030125, no 232 tariffs | | |
| | S11 | Dual Aluminum+Copper HTS + copper keyword - apply 99030133 + copper tariffs, no 99030125 | | |
| | S12 | Dual Aluminum+Copper HTS + aluminum keyword - apply 99030133 + aluminum 232, no 99030125 | | |
| | S13 | Zinc keyword - should ONLY apply 99030125, no 232 tariffs allowed | | |
| | S14 | Plastics keyword + metal HTS - override, should ONLY apply 99030125 | | |
| | S15 | Steel HTS + aluminum keyword - should apply 99030125, no 99030133 or 232 tariffs | | |
| | S16 | Aluminum HTS + steel keyword - should apply 99030125, no 99030133 or 232 tariffs | | |
| | S17 | Copper HTS but NO copper keyword - should apply copper tariffs + 99030125, no 99030133 | | |
| ## Key Additional HTS Codes | |
| | Code | Type | | |
| |------|------| | |
| | 99038190, 99038191 | Steel Section 232 | | |
| | 99038507, 99038508 | Aluminum Section 232 | | |
| | 99037801, 99037802 | Copper tariffs | | |
| | 99030133 | General 301 (accompanies 232) | | |
| | 99030125 | Mismatch/Override code | | |
| ## Input File Format | |
| Upload Excel file with these columns: | |
| - **Column E (Description)**: Product description for keyword matching | |
| - **Column F (Tariff)**: 10-digit Primary HTS code | |
| - **Columns I-N (Primary 1-6)**: Additional HTS codes applied | |
| ## Default Keywords | |
| **Metal**: steel, stainless steel, carbon steel, iron, metal | |
| **Aluminum**: aluminum, aluminium | |
| **Copper**: copper | |
| **Zinc**: zinc | |
| **Plastics**: plastic, abs, pu, pvc, polyester, nylon | |
| ## Tabs | |
| 1. **Upload & Filter**: Upload Excel file, apply initial filters | |
| 2. **Validation Results**: View all results with interactive filters, add to export cache | |
| 3. **Unique Combinations**: De-duplicated view by HTS+Description with occurrence count | |
| 4. **Keyword Management**: Edit keyword lists used for validation | |
| 5. **Export Selection**: Manage export cache and download Excel reports | |
| 6. **HTS Reference**: View Steel/Aluminum/Copper HTS lists and overlaps | |
| ## Password Protection | |
| The app requires password authentication. Configure it using one of these methods: | |
| ### For Hugging Face Spaces | |
| 1. Go to your Space's **Settings** > **Repository secrets** | |
| 2. Add a secret named `APP_PASSWORD` with your password value | |
| 3. The app will automatically use this for authentication | |
| ### For Local Development | |
| Set the environment variable before running: | |
| ```bash | |
| # Windows | |
| set HTS_CHECKER_PASSWORD=your_password_here | |
| streamlit run app.py | |
| # Linux/Mac | |
| export HTS_CHECKER_PASSWORD=your_password_here | |
| streamlit run app.py | |
| ``` | |
| Or create a `.streamlit/secrets.toml` file: | |
| ```toml | |
| APP_PASSWORD = "your_password_here" | |
| ``` | |
| **Note**: If no password is configured, the app runs without authentication (for development). | |
| ## Local Development | |
| ```bash | |
| cd HTS_Checker | |
| pip install -r requirements.txt | |
| streamlit run app.py | |
| ``` | |
| ## Hugging Face Deployment | |
| 1. Create a new Space on [Hugging Face](https://huggingface.co/spaces) | |
| 2. Select **Streamlit** as the SDK | |
| 3. Upload these files: | |
| - `app.py` | |
| - `hts_validator.py` | |
| - `HTS_list.py` | |
| - `requirements.txt` | |
| 4. Go to **Settings** > **Repository secrets** and add `APP_PASSWORD` | |
| 5. The app will auto-deploy with password protection | |
| ## Files | |
| | File | Description | | |
| |------|-------------| | |
| | `app.py` | Streamlit UI application | | |
| | `hts_validator.py` | Core validation logic | | |
| | `HTS_list.py` | Steel, Aluminum, Copper HTS code lists | | |
| | `requirements.txt` | Python dependencies | | |
| ## Requirements | |
| - streamlit | |
| - pandas | |
| - openpyxl | |