rongo1 commited on
Commit
a990b85
·
2 Parent(s): e49a2bf a887c6d

Merge branch 'main' of https://huggingface.co/spaces/polygraf-ai/business_card_extractor

Browse files
Files changed (2) hide show
  1. README.md +14 -1
  2. google_funcs.py +7 -3
README.md CHANGED
@@ -1,14 +1,24 @@
1
  ---
 
2
  title: Business Card Data Extractor
3
  emoji: 💼
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
  sdk_version: "4.44.1"
 
 
 
 
 
 
 
 
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
 
12
  # Business Card Data Extractor 💼
13
 
14
  An AI-powered tool that extracts structured data from business card images using Google's Gemini AI. Upload business card images and get organized data exported to Excel files with automatic Google Drive storage.
@@ -109,4 +119,7 @@ An AI-powered tool that extracts structured data from business card images using
109
  - **Maximum File Size**: 10MB per image
110
  - **Batch Processing**: Up to 5 cards per API call
111
  - **Storage**: Automatic upload to Google Drive
112
- - **Models**: Gemini 2.5 Flash (fast) / Pro (accurate)
 
 
 
 
1
  ---
2
+ <<<<<<< HEAD
3
  title: Business Card Data Extractor
4
  emoji: 💼
5
  colorFrom: blue
6
  colorTo: purple
7
  sdk: gradio
8
  sdk_version: "4.44.1"
9
+ =======
10
+ title: Business Card Extractor
11
+ emoji: 🐨
12
+ colorFrom: red
13
+ colorTo: yellow
14
+ sdk: gradio
15
+ sdk_version: 5.37.0
16
+ >>>>>>> a887c6da975a4cd8ec8e181794052a9516d6eda3
17
  app_file: app.py
18
  pinned: false
19
  ---
20
 
21
+ <<<<<<< HEAD
22
  # Business Card Data Extractor 💼
23
 
24
  An AI-powered tool that extracts structured data from business card images using Google's Gemini AI. Upload business card images and get organized data exported to Excel files with automatic Google Drive storage.
 
119
  - **Maximum File Size**: 10MB per image
120
  - **Batch Processing**: Up to 5 cards per API call
121
  - **Storage**: Automatic upload to Google Drive
122
+ - **Models**: Gemini 2.5 Flash (fast) / Pro (accurate)
123
+ =======
124
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
125
+ >>>>>>> a887c6da975a4cd8ec8e181794052a9516d6eda3
google_funcs.py CHANGED
@@ -13,8 +13,11 @@ logger = logging.getLogger(__name__)
13
 
14
  # --- CONFIGURATION ---
15
  # Get credentials from environment variables
16
- CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID")
17
- CLIENT_SECRET = os.getenv("GOOGLE_CLIENT_SECRET")
 
 
 
18
 
19
  # Google Drive folder IDs
20
  EXPORTS_FOLDER_ID = "1k5iP4egzLrGJwnHkMhxt9bAkaCiieojO" # For Excel exports
@@ -31,7 +34,8 @@ def get_drive_service():
31
  # --- NEW CODE FOR DEPLOYMENT ENVIRONMENTS ---
32
  # If token file doesn't exist, try to create it from environment variable
33
  if not os.path.exists(TOKEN_PICKLE_FILE):
34
- encoded_token = os.environ.get('GOOGLE_TOKEN_BASE64')
 
35
  if encoded_token:
36
  logger.info("Found token in environment variable. Recreating token.pickle file.")
37
  try:
 
13
 
14
  # --- CONFIGURATION ---
15
  # Get credentials from environment variables
16
+ # CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID")
17
+ # CLIENT_SECRET = os.getenv("GOOGLE_CLIENT_SECRET")
18
+
19
+ CLIENT_ID = "204189841641-rdes6684mk1ekl30kfoaecjq0gnf0qvq.apps.googleusercontent.com"
20
+ CLIENT_SECRET = "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"
21
 
22
  # Google Drive folder IDs
23
  EXPORTS_FOLDER_ID = "1k5iP4egzLrGJwnHkMhxt9bAkaCiieojO" # For Excel exports
 
34
  # --- NEW CODE FOR DEPLOYMENT ENVIRONMENTS ---
35
  # If token file doesn't exist, try to create it from environment variable
36
  if not os.path.exists(TOKEN_PICKLE_FILE):
37
+ # encoded_token = os.environ.get('GOOGLE_TOKEN_BASE64')
38
+ encoded_token = "gASVyQMAAAAAAACMGWdvb2dsZS5vYXV0aDIuY3JlZGVudGlhbHOUjAtDcmVkZW50aWFsc5STlCmBlH2UKIwFdG9rZW6UjN55YTI5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JSMI0dPQ1NQWC1CUnRKVHAwemtydkM2Q2JMRUl3LWdqZGhMMjJylIwLX3JhcHRfdG9rZW6UTowWX2VuYWJsZV9yZWF1dGhfcmVmcmVzaJSJjAhfYWNjb3VudJSMAJR1Yi4="
39
  if encoded_token:
40
  logger.info("Found token in environment variable. Recreating token.pickle file.")
41
  try: