Ali Abdullah commited on
Commit
64a14b6
·
verified ·
1 Parent(s): a60683b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -5
main.py CHANGED
@@ -14,10 +14,12 @@ import whisper
14
  # Load environment variables
15
  load_dotenv()
16
 
17
- # Set tesseract and ffmpeg paths for Hugging Face Spaces
18
- tesseract_cmd = "tesseract"
19
- pytesseract.pytesseract.tesseract_cmd = tesseract_cmd
20
- os.environ["PATH"] += os.pathsep + "/usr/bin"
 
 
21
 
22
  # File reading libraries
23
  from docx import Document
@@ -26,7 +28,7 @@ import PyPDF2
26
 
27
  app = FastAPI()
28
 
29
- # Use Groq API key from .env
30
  client = Groq(api_key=os.getenv("GROQ_API_KEY"))
31
 
32
  UPLOAD_DIR = "uploaded_files"
 
14
  # Load environment variables
15
  load_dotenv()
16
 
17
+ # Tesseract path
18
+ pytesseract.pytesseract.tesseract_cmd = os.getenv("TESSERACT_CMD", "/usr/bin/tesseract")
19
+
20
+ # FFmpeg path (for local development only)
21
+ ffmpeg_path = os.getenv("FFMPEG_PATH", "/usr/bin")
22
+ os.environ["PATH"] += os.pathsep + ffmpeg_path
23
 
24
  # File reading libraries
25
  from docx import Document
 
28
 
29
  app = FastAPI()
30
 
31
+ # Use Groq API key from secrets
32
  client = Groq(api_key=os.getenv("GROQ_API_KEY"))
33
 
34
  UPLOAD_DIR = "uploaded_files"