Dave67350 commited on
Commit
fd6b4ee
·
verified ·
1 Parent(s): e82fc05

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +16 -2
Gradio_UI.py CHANGED
@@ -1,4 +1,3 @@
1
- # gradio_UI.py
2
  import gradio as gr
3
  from fpdf import FPDF
4
  from langdetect import detect
@@ -27,11 +26,27 @@ def export_pdf(title, answers, lang="en"):
27
  pdf = FPDF()
28
  pdf.add_page()
29
  pdf.set_auto_page_break(auto=True, margin=15)
 
 
30
  pdf.set_font("Arial", 'B', 16)
31
  pdf.set_text_color(0, 51, 102)
32
  pdf.cell(0, 10, title, ln=True, align='C')
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  pdf.ln(10)
34
 
 
35
  pdf.set_font("Arial", '', 12)
36
  pdf.set_text_color(0, 0, 0)
37
  for label, value in answers.items():
@@ -99,7 +114,6 @@ with gr.Blocks(
99
  display: none !important;
100
  }
101
 
102
- /* Disable share button click */
103
  button[aria-label="Share"],
104
  button[title="Share"],
105
  button[data-testid="share-button"] {
 
 
1
  import gradio as gr
2
  from fpdf import FPDF
3
  from langdetect import detect
 
26
  pdf = FPDF()
27
  pdf.add_page()
28
  pdf.set_auto_page_break(auto=True, margin=15)
29
+
30
+ # Title
31
  pdf.set_font("Arial", 'B', 16)
32
  pdf.set_text_color(0, 51, 102)
33
  pdf.cell(0, 10, title, ln=True, align='C')
34
+ pdf.ln(8)
35
+
36
+ # Metadata section
37
+ company = answers.get("What is the name of your organization?", "N/A")
38
+ name = answers.get("What is your name?", "N/A")
39
+ role = answers.get("What is your role?", "N/A")
40
+ timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
41
+
42
+ pdf.set_font("Arial", 'I', 11)
43
+ pdf.set_text_color(80, 80, 80)
44
+ pdf.cell(0, 8, f"Organization: {company}", ln=True, align='C')
45
+ pdf.cell(0, 8, f"Completed by: {name} ({role})", ln=True, align='C')
46
+ pdf.cell(0, 8, f"Timestamp: {timestamp}", ln=True, align='C')
47
  pdf.ln(10)
48
 
49
+ # Main content
50
  pdf.set_font("Arial", '', 12)
51
  pdf.set_text_color(0, 0, 0)
52
  for label, value in answers.items():
 
114
  display: none !important;
115
  }
116
 
 
117
  button[aria-label="Share"],
118
  button[title="Share"],
119
  button[data-testid="share-button"] {