Ali Abdullah
commited on
Update main.py
Browse files
main.py
CHANGED
|
@@ -14,10 +14,12 @@ import whisper
|
|
| 14 |
# Load environment variables
|
| 15 |
load_dotenv()
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
tesseract_cmd = "tesseract"
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 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
|
| 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"
|