IAMTFRMZA commited on
Commit
70b5f49
·
verified ·
1 Parent(s): cfe3a26
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -103,6 +103,8 @@ if uploaded_file:
103
  # Add a title and style
104
  title = doc.add_heading('AI Assistant Report', 0)
105
  title.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER # Center align the title
 
 
106
 
107
  # Add Executive Summary
108
  doc.add_heading('Executive Summary', level=1)
@@ -132,7 +134,7 @@ if uploaded_file:
132
  row[4].text = "207"
133
  row[5].text = "-3.0"
134
 
135
- # Add Assistant's analysis
136
  doc.add_heading('Step 2: Assistant Analysis', level=1)
137
  doc.add_paragraph(f"The AI Assistant's insights are:\n{assistant_message}")
138
 
@@ -160,6 +162,16 @@ if uploaded_file:
160
  row[1].text = sales
161
  row[2].text = profit
162
 
 
 
 
 
 
 
 
 
 
 
163
  # Saving the DOCX file
164
  word_filename = "AI_Report_Formatted.docx"
165
  doc.save(word_filename)
@@ -175,4 +187,3 @@ if uploaded_file:
175
 
176
  except Exception as e:
177
  st.error(f"Error processing the chat: {str(e)}")
178
-
 
103
  # Add a title and style
104
  title = doc.add_heading('AI Assistant Report', 0)
105
  title.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER # Center align the title
106
+ title.bold = True
107
+ title.font.size = Pt(18)
108
 
109
  # Add Executive Summary
110
  doc.add_heading('Executive Summary', level=1)
 
134
  row[4].text = "207"
135
  row[5].text = "-3.0"
136
 
137
+ # Step 2: Assistant's Analysis
138
  doc.add_heading('Step 2: Assistant Analysis', level=1)
139
  doc.add_paragraph(f"The AI Assistant's insights are:\n{assistant_message}")
140
 
 
162
  row[1].text = sales
163
  row[2].text = profit
164
 
165
+ # Style Table Text (bold for headings, adjust font size)
166
+ for cell in hdr_cells:
167
+ cell.paragraphs[0].runs[0].bold = True
168
+ cell.paragraphs[0].runs[0].font.size = Pt(10.5)
169
+
170
+ # Adjust font size and add bold to data cells
171
+ for row in table.rows:
172
+ for cell in row.cells:
173
+ cell.paragraphs[0].runs[0].font.size = Pt(10.5)
174
+
175
  # Saving the DOCX file
176
  word_filename = "AI_Report_Formatted.docx"
177
  doc.save(word_filename)
 
187
 
188
  except Exception as e:
189
  st.error(f"Error processing the chat: {str(e)}")