fionasu commited on
Commit
597e8a0
·
verified ·
1 Parent(s): a4ee567

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -11,15 +11,12 @@ import os
11
  def generate_pdf_from_chat(chat_history):
12
  pdf = FPDF()
13
  pdf.add_page()
14
-
15
- # Register the Arial font (uploaded to the Space's fonts directory)
16
- pdf.add_font("NotoSans", "", "NotoSans-Regular.ttf", uni=True)
17
- pdf.set_font("NotoSans","", size=12)
18
 
19
  for user_msg, bot_msg in chat_history:
20
  pdf.multi_cell(0, 10, txt=f"User: {user_msg}", align='L')
21
  pdf.multi_cell(0, 10, txt=f"Bot: {bot_msg}", align='L')
22
- pdf.ln(5)
23
 
24
  file_path = f"/tmp/travel_chat_{uuid.uuid4().hex}.pdf"
25
  pdf.output(file_path)
 
11
  def generate_pdf_from_chat(chat_history):
12
  pdf = FPDF()
13
  pdf.add_page()
14
+ pdf.set_font("Times", size=12) # Use built-in 'Times' font
 
 
 
15
 
16
  for user_msg, bot_msg in chat_history:
17
  pdf.multi_cell(0, 10, txt=f"User: {user_msg}", align='L')
18
  pdf.multi_cell(0, 10, txt=f"Bot: {bot_msg}", align='L')
19
+ pdf.ln(5) # Add some spacing between exchanges
20
 
21
  file_path = f"/tmp/travel_chat_{uuid.uuid4().hex}.pdf"
22
  pdf.output(file_path)