Updated cursor version
Browse files
README.md
CHANGED
|
@@ -1,15 +1,104 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Business Category Description Generator
|
| 2 |
+
|
| 3 |
+
A Hugging Face Gradio application that generates CLIP-ready visual descriptions for business category keywords from CSV files.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
- 📤 **Upload Multiple CSV Files**: Process one or more CSV files at once
|
| 8 |
+
- 🔄 **Batch Processing**: Automatically processes all unique categories from your files
|
| 9 |
+
- 🤖 **AI-Powered**: Uses Meta's Llama 3.3 70B model for high-quality descriptions
|
| 10 |
+
- 📊 **Progress Tracking**: Real-time progress updates during processing
|
| 11 |
+
- 💾 **Automatic Saving**: Output files are automatically generated with timestamps
|
| 12 |
+
- 📥 **Easy Download**: Download all processed files directly from the interface
|
| 13 |
+
|
| 14 |
+
## How to Use
|
| 15 |
+
|
| 16 |
+
### 1. Deploy to Hugging Face Spaces
|
| 17 |
+
|
| 18 |
+
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
|
| 19 |
+
2. Click "Create new Space"
|
| 20 |
+
3. Choose "Gradio" as the SDK
|
| 21 |
+
4. Upload `app.py` and `requirements.txt`
|
| 22 |
+
5. Your app will be deployed automatically!
|
| 23 |
+
|
| 24 |
+
### 2. Prepare Your CSV Files
|
| 25 |
+
|
| 26 |
+
Your CSV files should contain a column with business category keywords. For example:
|
| 27 |
+
|
| 28 |
+
```csv
|
| 29 |
+
category,other_column
|
| 30 |
+
Car Rental For Self Driven,additional_data
|
| 31 |
+
Mehandi,additional_data
|
| 32 |
+
Photographer,additional_data
|
| 33 |
+
Equipment,additional_data
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
### 3. Use the Application
|
| 37 |
+
|
| 38 |
+
1. **Login**: Click the login button and authenticate with your Hugging Face account
|
| 39 |
+
2. **Upload Files**: Upload one or more CSV files
|
| 40 |
+
3. **Specify Column**: Enter the name of the column containing categories (default: "category")
|
| 41 |
+
4. **Adjust Settings** (optional):
|
| 42 |
+
- Max Tokens: 64-512 (default: 256)
|
| 43 |
+
- Temperature: 0.1-1.0 (default: 0.7)
|
| 44 |
+
- Top-p: 0.1-1.0 (default: 0.9)
|
| 45 |
+
5. **Process**: Click "Process Files" and wait for completion
|
| 46 |
+
6. **Download**: Download the output CSV files with descriptions
|
| 47 |
+
|
| 48 |
+
## Output Format
|
| 49 |
+
|
| 50 |
+
Each output CSV file contains:
|
| 51 |
+
|
| 52 |
+
| Column | Description |
|
| 53 |
+
|--------|-------------|
|
| 54 |
+
| `Category` | The original category keyword |
|
| 55 |
+
| `Description` | The generated CLIP-ready visual description |
|
| 56 |
+
| `Raw_Response` | The complete model response (JSON format) |
|
| 57 |
+
|
| 58 |
+
## Example Output
|
| 59 |
+
|
| 60 |
+
```csv
|
| 61 |
+
Category,Description,Raw_Response
|
| 62 |
+
Car Rental For Self Driven,"a car available for self-drive rental, parked at a pickup spot without a chauffeur; looks travel-ready, clean, well-maintained, keys handed over to customer","{""Category"": ""Car Rental For Self Driven"", ""Description"": ""...""}"
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Model Settings
|
| 66 |
+
|
| 67 |
+
- **Max Tokens**: Controls the maximum length of generated descriptions
|
| 68 |
+
- **Temperature**: Higher values (0.8-1.0) make output more creative, lower values (0.3-0.5) make it more focused
|
| 69 |
+
- **Top-p**: Nucleus sampling parameter, controls diversity
|
| 70 |
+
|
| 71 |
+
## Technical Details
|
| 72 |
+
|
| 73 |
+
- **Model**: meta-llama/Llama-3.3-70B-Instruct
|
| 74 |
+
- **Framework**: Gradio 4.0+
|
| 75 |
+
- **Processing**: Categories are deduplicated automatically
|
| 76 |
+
- **Output Files**: Named as `output_{original_name}_{timestamp}.csv`
|
| 77 |
+
|
| 78 |
+
## Troubleshooting
|
| 79 |
+
|
| 80 |
+
### "Column not found" error
|
| 81 |
+
- Check that the column name matches exactly (case-sensitive)
|
| 82 |
+
- View the error message to see available columns
|
| 83 |
+
|
| 84 |
+
### "Please login" error
|
| 85 |
+
- Make sure you're logged in with a valid Hugging Face account
|
| 86 |
+
- Check that your account has access to the Inference API
|
| 87 |
+
|
| 88 |
+
### Slow processing
|
| 89 |
+
- The model processes each unique category individually
|
| 90 |
+
- Large files with many unique categories will take longer
|
| 91 |
+
- Consider splitting very large files into smaller batches
|
| 92 |
+
|
| 93 |
+
## Local Development
|
| 94 |
+
|
| 95 |
+
To run locally:
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
pip install -r requirements.txt
|
| 99 |
+
python app.py
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## License
|
| 103 |
+
|
| 104 |
+
This project uses the Llama 3.3 model which requires agreement to Meta's license terms.
|