Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,8 @@ GROQ_API_KEY = os.getenv("GROQ_API_KEY") # Fetch from environment variables
|
|
| 17 |
if not GROQ_API_KEY:
|
| 18 |
raise ValueError("GROQ_API_KEY is not set. Add it in Hugging Face Secrets.")
|
| 19 |
|
| 20 |
-
# Initialize LLM
|
| 21 |
-
llm = ChatGroq(model_name="
|
| 22 |
|
| 23 |
def extract_text_from_pdf(pdf_file):
|
| 24 |
"""Extracts clean text from a text-based PDF while handling edge cases."""
|
|
@@ -38,7 +38,7 @@ def extract_text_from_pdf(pdf_file):
|
|
| 38 |
return text.strip()
|
| 39 |
|
| 40 |
def summarize_text(text, length, style):
|
| 41 |
-
"""Summarizes extracted text
|
| 42 |
prompt = (
|
| 43 |
f"""
|
| 44 |
Read the following document and summarize it in {style.lower()} format.
|
|
|
|
| 17 |
if not GROQ_API_KEY:
|
| 18 |
raise ValueError("GROQ_API_KEY is not set. Add it in Hugging Face Secrets.")
|
| 19 |
|
| 20 |
+
# Initialize LLM
|
| 21 |
+
llm = ChatGroq(model_name="llama-3.3-70b-versatile")
|
| 22 |
|
| 23 |
def extract_text_from_pdf(pdf_file):
|
| 24 |
"""Extracts clean text from a text-based PDF while handling edge cases."""
|
|
|
|
| 38 |
return text.strip()
|
| 39 |
|
| 40 |
def summarize_text(text, length, style):
|
| 41 |
+
"""Summarizes extracted text with structured formatting."""
|
| 42 |
prompt = (
|
| 43 |
f"""
|
| 44 |
Read the following document and summarize it in {style.lower()} format.
|