business_card_extractor / setup_hf_space.md
rongo1
feat: trying to fix localhost issue
3b89417
# Hugging Face Spaces Setup Guide
## Quick Deployment to Hugging Face Spaces
### 1. Create a New Space
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
2. Click "Create new Space"
3. Choose:
- **Space name**: `business-card-extractor`
- **License**: `mit`
- **Space SDK**: `gradio`
- **Visibility**: `public` or `private`
### 2. Upload Files
Upload these files to your space:
```
app.py
requirements.txt
prompts/prompt.txt
prompts/system_prompt.txt
README.md
business_cards/.gitkeep
```
**Note**: The `business_cards/` and `business_card_exports/` directories will be created automatically.
### 3. Set Environment Variables
1. Go to your Space **Settings**
2. Scroll to **Repository secrets**
3. Click **Add a new secret**
4. Add these secrets:
**Required:**
- **Name**: `Gemini_API`
- **Value**: Your AI API key
**Optional (for password protection):**
- **Name**: `SPACE_PASSWORD`
- **Value**: Your desired password
- **Note**: Users will login with username: `user` and this password
### 4. Get Your AI API Key
1. Go to [Google AI Studio](https://aistudio.google.com/)
2. Click "Get API key"
3. Create a new API key
4. Copy the key for use in step 3
### 5. Your Space is Ready!
- The space will automatically build and deploy
- It will be available at: `https://huggingface.co/spaces/YOUR_USERNAME/business-card-extractor`
- All business card images and Excel files will be saved in the space
## Features Available in Hugging Face Spaces
βœ… **Full functionality**: All features work in Hugging Face Spaces
βœ… **Image storage**: Business cards saved to `business_cards/` folder
βœ… **Excel exports**: Download both current run and cumulative files
βœ… **Persistent storage**: All data preserved between sessions
βœ… **Batch processing**: Efficient 5-cards-per-API-call processing
## Environment Variables Required
- `Gemini_API`: Your AI API key (required)
- `SPACE_PASSWORD`: Password for space access (optional)
## Notes
- The space will create necessary directories automatically
- Logs are available in the space's terminal/logs
- All uploaded images are processed and optionally saved
- Excel files accumulate over time in the cumulative database