Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ load_dotenv()
|
|
| 28 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 29 |
|
| 30 |
# Initialize LLM
|
| 31 |
-
llm = ChatGroq(temperature=0.5, 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", model_name="llama3-8b-8192")
|
| 32 |
|
| 33 |
# OCR Configuration
|
| 34 |
pytesseract.pytesseract.tesseract_cmd = r"/usr/bin/tesseract" # Adjust based on your system's path
|
|
@@ -198,17 +198,6 @@ def save_as_docx(questions, answers):
|
|
| 198 |
doc_output.seek(0)
|
| 199 |
return doc_output
|
| 200 |
|
| 201 |
-
# Save questions and answers as CSV
|
| 202 |
-
def save_as_csv(questions, answers):
|
| 203 |
-
df = pd.DataFrame({
|
| 204 |
-
"Question": questions.split("\n"),
|
| 205 |
-
"Answer": answers.split("\n")
|
| 206 |
-
})
|
| 207 |
-
csv_output = BytesIO()
|
| 208 |
-
df.to_csv(csv_output, index=False)
|
| 209 |
-
csv_output.seek(0)
|
| 210 |
-
return csv_output
|
| 211 |
-
|
| 212 |
# Function to extract files from a ZIP archive
|
| 213 |
def extract_zip_file(zip_file):
|
| 214 |
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
|
|
|
|
| 28 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 29 |
|
| 30 |
# Initialize LLM
|
| 31 |
+
llm = ChatGroq(temperature=0.5, groq_api_key="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", model_name="llama3-8b-8192")
|
| 32 |
|
| 33 |
# OCR Configuration
|
| 34 |
pytesseract.pytesseract.tesseract_cmd = r"/usr/bin/tesseract" # Adjust based on your system's path
|
|
|
|
| 198 |
doc_output.seek(0)
|
| 199 |
return doc_output
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
# Function to extract files from a ZIP archive
|
| 202 |
def extract_zip_file(zip_file):
|
| 203 |
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
|