Spaces:
Sleeping
Sleeping
usernameiskheejay
commited on
Commit
·
ee608d5
1
Parent(s):
4e31ca1
Fix pdf print out error
Browse files
app.py
CHANGED
|
@@ -4,7 +4,8 @@ import google.generativeai as genai
|
|
| 4 |
from PyPDF2 import PdfReader
|
| 5 |
from fpdf import FPDF
|
| 6 |
|
| 7 |
-
genai.configure(api_key=
|
|
|
|
| 8 |
|
| 9 |
generation_config = {
|
| 10 |
"temperature": 2,
|
|
@@ -40,11 +41,14 @@ def create_pdf(content):
|
|
| 40 |
"""Create a well-formatted PDF file from the given content."""
|
| 41 |
pdf = FPDF()
|
| 42 |
pdf.add_page()
|
|
|
|
| 43 |
pdf.set_font("Arial", size=12)
|
|
|
|
| 44 |
lines = content.split("\n")
|
| 45 |
for line in lines:
|
| 46 |
formatted_line = line.replace("**", "") # Remove markdown-style bolding
|
| 47 |
pdf.multi_cell(0, 10, formatted_line)
|
|
|
|
| 48 |
return pdf
|
| 49 |
|
| 50 |
# Streamlit UI
|
|
|
|
| 4 |
from PyPDF2 import PdfReader
|
| 5 |
from fpdf import FPDF
|
| 6 |
|
| 7 |
+
genai.configure(api_key="AIzaSyCHtsaOe5k-MXYO0RDnytc6iX7FpSKCPmE")
|
| 8 |
+
#genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
|
| 9 |
|
| 10 |
generation_config = {
|
| 11 |
"temperature": 2,
|
|
|
|
| 41 |
"""Create a well-formatted PDF file from the given content."""
|
| 42 |
pdf = FPDF()
|
| 43 |
pdf.add_page()
|
| 44 |
+
|
| 45 |
pdf.set_font("Arial", size=12)
|
| 46 |
+
|
| 47 |
lines = content.split("\n")
|
| 48 |
for line in lines:
|
| 49 |
formatted_line = line.replace("**", "") # Remove markdown-style bolding
|
| 50 |
pdf.multi_cell(0, 10, formatted_line)
|
| 51 |
+
|
| 52 |
return pdf
|
| 53 |
|
| 54 |
# Streamlit UI
|