rameshmoorthy commited on
Commit
438413d
·
verified ·
1 Parent(s): 7307caf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -47,25 +47,25 @@ with gr.Blocks() as bm25:
47
  df = pd.read_excel(file)
48
  else:
49
  doc = "Unsupported file format. Please provide a CSV or Excel file."
50
- return doc # Return immediately with the error message
51
 
52
  # Ensure that the 'products' column is present in the dataframe
53
  if 'products' not in df.columns.str.lower():
54
  doc = "The input file must have a column named 'products'."
55
- return doc # Return immediately with the error message
56
 
57
  doc = 'File uploaded! Press Cluster button'
58
- return doc # Return the success message
59
 
60
 
61
  def download_df():
62
- df1=state.df
63
  print(df1)
64
  return df1
65
 
66
  out = gr.Textbox()
67
  mode=gr.Radio(["Automated clustering", "Manually choose parameters"], label="Type of algorithm", value="Automated clustering",info="Choose any mode u want")
68
- inputfile.upload(confirmation,inputs=[inputfile],outputs=out)
69
  with gr.Row():
70
 
71
  min_cluster_size=gr.Slider(2, 500, value=5, step=1,label="min_cluster_size", info="Choose minimum No. of docs in a cluster. Lower the value ,higher the clusters created")
@@ -88,7 +88,7 @@ with gr.Blocks() as bm25:
88
  gr.Plot(label="Hierarchy"),
89
 
90
  ])
91
- llm_btn = gr.Button(value="AI generation ")
92
  llm_btn.click(download_df,inputs=[],outputs=gr.Dataframe(label="Output"))
93
 
94
 
 
47
  df = pd.read_excel(file)
48
  else:
49
  doc = "Unsupported file format. Please provide a CSV or Excel file."
50
+ return None,doc # Return immediately with the error message
51
 
52
  # Ensure that the 'products' column is present in the dataframe
53
  if 'products' not in df.columns.str.lower():
54
  doc = "The input file must have a column named 'products'."
55
+ return None,doc # Return immediately with the error message
56
 
57
  doc = 'File uploaded! Press Cluster button'
58
+ return df,doc # Return the success message
59
 
60
 
61
  def download_df():
62
+ df1=df_bm25
63
  print(df1)
64
  return df1
65
 
66
  out = gr.Textbox()
67
  mode=gr.Radio(["Automated clustering", "Manually choose parameters"], label="Type of algorithm", value="Automated clustering",info="Choose any mode u want")
68
+ inputfile.upload(confirmation,inputs=[inputfile],outputs=[gr.File(label="Uploaded File"),out])
69
  with gr.Row():
70
 
71
  min_cluster_size=gr.Slider(2, 500, value=5, step=1,label="min_cluster_size", info="Choose minimum No. of docs in a cluster. Lower the value ,higher the clusters created")
 
88
  gr.Plot(label="Hierarchy"),
89
 
90
  ])
91
+ llm_btn = gr.Button(value="Download Excel with Topics ")
92
  llm_btn.click(download_df,inputs=[],outputs=gr.Dataframe(label="Output"))
93
 
94