SantanuBanerjee commited on
Commit
3d103e2
·
verified ·
1 Parent(s): 5950746

Update app.py

Browse files

Changed output from a dataframe to a downloadable Excel File

Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -54,8 +54,11 @@ def process_excel(file):
54
 
55
  # Process the DataFrame
56
  result_df = nlp_pipeline(df)
 
 
 
57
 
58
- return result_df # Return the processed DataFrame
59
 
60
  except Exception as e:
61
  return str(e) # Return the error message
@@ -64,9 +67,14 @@ def process_excel(file):
64
  interface = gr.Interface(
65
  fn=process_excel, # The function to process the uploaded file
66
  inputs=gr.File(type="filepath", label="Upload Excel File"), # File upload input
67
- outputs="dataframe", # Display the output as a DataFrame
 
68
  title="Excel File Uploader",
69
- description="Upload an Excel file to see the first few rows."
 
 
 
 
70
  )
71
 
72
  # Launch the interface
 
54
 
55
  # Process the DataFrame
56
  result_df = nlp_pipeline(df)
57
+
58
+ output_file = "OutPut_file.xlsx"
59
+ result_df.to_excel(output_file, index=False)
60
 
61
+ return output_file # Return the processed DataFrame as Excel file
62
 
63
  except Exception as e:
64
  return str(e) # Return the error message
 
67
  interface = gr.Interface(
68
  fn=process_excel, # The function to process the uploaded file
69
  inputs=gr.File(type="filepath", label="Upload Excel File"), # File upload input
70
+
71
+ outputs=gr.File(label="Download Processed Excel File"), # File download output
72
  title="Excel File Uploader",
73
+ description="Upload an Excel file to process and download the result."
74
+
75
+ # outputs="dataframe", # Display the output as a DataFrame
76
+ # title="Excel File Uploader",
77
+ # description="Upload an Excel file to see the first few rows."
78
  )
79
 
80
  # Launch the interface