rajsecrets0 commited on
Commit
f0e314b
·
verified ·
1 Parent(s): bbaef50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -16,6 +16,10 @@ from reportlab.lib.pagesizes import letter
16
  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle
17
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
18
  import io
 
 
 
 
19
 
20
  # Configure logging
21
  logging.basicConfig(
@@ -26,8 +30,8 @@ logger = logging.getLogger(__name__)
26
 
27
  # Configuration and Constants
28
  class Config:
29
- GEMINI_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent"
30
- GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "YOUR_API_KEY")
31
  MAX_RETRIES = 3
32
  TIMEOUT = 30
33
  MAX_IMAGE_SIZE = (1600, 1600)
@@ -175,6 +179,7 @@ class PDFGenerator:
175
  doc.build(elements)
176
  return buffer.getvalue()
177
 
 
178
  class ImageProcessor:
179
  @staticmethod
180
  def validate_image(uploaded_file) -> tuple[bool, str]:
 
16
  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle
17
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
18
  import io
19
+ from dotenv import load_dotenv
20
+
21
+ # Load environment variables
22
+ load_dotenv()
23
 
24
  # Configure logging
25
  logging.basicConfig(
 
30
 
31
  # Configuration and Constants
32
  class Config:
33
+ GEMINI_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent"
34
+ GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
35
  MAX_RETRIES = 3
36
  TIMEOUT = 30
37
  MAX_IMAGE_SIZE = (1600, 1600)
 
179
  doc.build(elements)
180
  return buffer.getvalue()
181
 
182
+
183
  class ImageProcessor:
184
  @staticmethod
185
  def validate_image(uploaded_file) -> tuple[bool, str]: