File size: 3,816 Bytes
595f63f
a887c6d
 
 
 
 
 
595f63f
 
 
29d41e1
595f63f
29d41e1
87132f1
29d41e1
595f63f
29d41e1
595f63f
87132f1
c609854
595f63f
 
 
 
c609854
29d41e1
595f63f
29d41e1
c609854
595f63f
87132f1
595f63f
c609854
29d41e1
595f63f
29d41e1
595f63f
 
 
 
 
 
 
 
29d41e1
c609854
29d41e1
87132f1
c609854
 
29d41e1
c609854
 
 
 
29d41e1
c609854
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87132f1
c609854
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87132f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
title: Business Card Extractor
emoji: 🐨
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: 5.37.0
app_file: app.py
pinned: false
---

# Business Card Data Extractor 💼

An AI-powered tool that extracts structured data from business card images using advanced AI models. Upload business card images and get organized data exported to Excel files with automatic Google Drive storage.

## Features

- **Batch Processing**: Process multiple business cards at once (up to 5 per batch)
- **AI Model Selection**: Choose between Speed-Optimized AI (fast) or Accuracy-Optimized AI (high accuracy)
- **Google Drive Storage**: Automatic upload to organized Drive folders
- **Excel Export**: Get data in two formats:
  - Current session results
  - Cumulative database (appends across sessions)
- **Smart Data Extraction**: Extracts name, company, title, emails, phones, address, website
- **Direct Links**: Access files directly through Google Drive URLs

## How to Use

1. **Setup**: Complete the setup process below (one-time)
2. **Upload Images**: Select up to 5 business card images
3. **Choose Model**: Select AI model (Speed-Optimized for fast processing, Accuracy-Optimized for best results)
4. **Process**: Click "Extract Business Card Data"
5. **Access Files**: Download temporary copies or access permanent files via Google Drive links

## Supported Data Fields

- **Name**: Full name from business card
- **Company**: Company/organization name
- **Title**: Job title/position
- **Emails**: Email addresses (comma-separated if multiple)
- **Phones**: Phone numbers (comma-separated if multiple)
- **Address**: Full address information
- **Website**: Company website URL
- **Processing Info**: Timestamp, model used, filename

## Setup Instructions

### 1. AI API Key
- Get your API key from: https://aistudio.google.com/
- Set as environment variable: `Gemini_API`

### 2. Google Drive API Setup
1. **Create Google Cloud Project**:
   - Go to https://console.cloud.google.com/
   - Create a new project or select an existing one

2. **Enable Google Drive API**:
   - In the Google Cloud Console, go to "APIs & Services" > "Library"
   - Search for "Google Drive API" and enable it

3. **Create OAuth 2.0 Credentials**:
   - Go to "APIs & Services" > "Credentials"
   - Click "+ CREATE CREDENTIALS" > "OAuth client ID"
   - Select "Desktop application"
   - Download the JSON file
   - Extract `client_id` and `client_secret` from the JSON

4. **Set Environment Variables**:
   ```bash
   GOOGLE_CLIENT_ID=your_client_id_here
   GOOGLE_CLIENT_SECRET=your_client_secret_here
   ```

### 3. Local Development Setup
1. **Install Dependencies**:
   ```bash
   pip install -r requirements.txt
   ```

2. **Run Locally First**:
   ```bash
   python app.py
   ```
   - Complete the OAuth flow in your browser
   - This creates `token.pickle` file

### 4. Deployment Setup (Hugging Face Spaces, etc.)
1. **Generate Token for Deployment**:
   ```bash
   python convert_token_to_base64.py
   ```
   - This converts `token.pickle` to a base64 string

2. **Set Environment Variables** in your deployment platform:
   ```bash
   Gemini_API=your_ai_api_key
   GOOGLE_CLIENT_ID=your_google_client_id
   GOOGLE_CLIENT_SECRET=your_google_client_secret
   GOOGLE_TOKEN_BASE64=your_base64_encoded_token
   ```

## Google Drive Folders
- **📁 Exports**: https://drive.google.com/drive/folders/1k5iP4egzLrGJwnHkMhxt9bAkaCiieojO
- **🖼️ Images**: https://drive.google.com/drive/folders/1gd280IqcAzpAFTPeYsZjoBUOU9S7Zx3c

## Technical Details

- **Image Formats**: JPG, JPEG, PNG, WEBP, BMP
- **Maximum File Size**: 10MB per image
- **Batch Processing**: Up to 5 cards per API call
- **Storage**: Automatic upload to Google Drive
- **Models**: Speed-Optimized AI (fast processing) / Accuracy-Optimized AI (best accuracy)