Redmind commited on
Commit
fb92eb1
·
verified ·
1 Parent(s): 4a75fd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -1231,7 +1231,7 @@ def handle_large_dataset(df, create_document,isDataFrame):
1231
  #Logic to generate pdfs with employee name and account number
1232
  for index, row in df.iterrows():
1233
  # Create a PDF for each row
1234
- create_pdf(row['Account Name'], row['Account ID'])
1235
  create_document = False
1236
  docstatus += f" {total_rows} documents are created successfully."
1237
  print(sample_table)
@@ -1244,18 +1244,17 @@ def handle_large_dataset(df, create_document,isDataFrame):
1244
 
1245
  else:
1246
  return "Your query returns a large dataset which is not supported in the current version. Please try a different query."
1247
- def create_pdf(name,id):
1248
 
1249
 
1250
- filled = FormWrapper("Goldman_LOA - Gold.pdf").fill(
1251
  {
1252
- "Title of Account": name,
1253
- "Account Number": id,
1254
- "Print Name and Title": name
1255
  },
1256
  )
1257
- #output_file_name = f"documents\\{name}.pdf"
1258
- output_file_name = f"{name}.pdf"
1259
  with open(output_file_name, "wb+") as output:
1260
  output.write(filled.read())
1261
 
@@ -1369,7 +1368,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
1369
  sample_button = gr.Button("What are the details of ASN24091600002", elem_classes="gr-buttonbig")
1370
  sample_button1 = gr.Button("What are the active warehouses available", elem_classes="gr-buttonbig")
1371
  sample_button2 = gr.Button("Explain Pre-Receiving Yard Management", elem_classes="gr-buttonbig")
1372
- sample_button3 = gr.Button("can you generate a histogram chart with item name and customer for warehouse WH1000001", elem_classes="gr-buttonbig")
1373
  sample_button4 = gr.Button("Analyze item name & quantity for different customers in a stacked bar chart for the warehouse WH1000001 & send email to [email protected]", elem_classes="gr-button")
1374
 
1375
  # Chatbot component
 
1231
  #Logic to generate pdfs with employee name and account number
1232
  for index, row in df.iterrows():
1233
  # Create a PDF for each row
1234
+ create_pdf(row['COMPANY'], row['EMPLOYEE NAME'])
1235
  create_document = False
1236
  docstatus += f" {total_rows} documents are created successfully."
1237
  print(sample_table)
 
1244
 
1245
  else:
1246
  return "Your query returns a large dataset which is not supported in the current version. Please try a different query."
1247
+ def create_pdf(cname,ename):
1248
 
1249
 
1250
+ filled = FormWrapper("LOA_Sample.pdf").fill(
1251
  {
1252
+ "company name": cname,
1253
+ "employee name": ename,
1254
+
1255
  },
1256
  )
1257
+ output_file_name = f"documents\\{ename}_{cname}.pdf"
 
1258
  with open(output_file_name, "wb+") as output:
1259
  output.write(filled.read())
1260
 
 
1368
  sample_button = gr.Button("What are the details of ASN24091600002", elem_classes="gr-buttonbig")
1369
  sample_button1 = gr.Button("What are the active warehouses available", elem_classes="gr-buttonbig")
1370
  sample_button2 = gr.Button("Explain Pre-Receiving Yard Management", elem_classes="gr-buttonbig")
1371
+ sample_button3 = gr.Button("can you generate a doughnut chart with item name and quantities for warehouse WH1000001", elem_classes="gr-buttonbig")
1372
  sample_button4 = gr.Button("Analyze item name & quantity for different customers in a stacked bar chart for the warehouse WH1000001 & send email to [email protected]", elem_classes="gr-button")
1373
 
1374
  # Chatbot component