Amirizaniani commited on
Commit
427d9b2
·
verified ·
1 Parent(s): 01d313d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -144,7 +144,7 @@ def process_inputs(llm, file, relevance, diversity):
144
  if file is not None:
145
  # Read questions from the uploaded Excel file
146
  try:
147
- df = pd.read_excel(file.name, engine='openpyxl')
148
  except Exception as e:
149
  return f"Failed to read Excel file: {e}", None
150
 
@@ -152,15 +152,26 @@ def process_inputs(llm, file, relevance, diversity):
152
  if df.shape[1] != 1:
153
  return "The uploaded file must contain only one column of questions.", None
154
 
 
155
  questions_list = df.iloc[:, 0]
156
 
157
- # Save the first column to a new Excel file
 
 
 
 
 
 
 
 
 
158
  output_file = "processed_questions.xlsx"
159
- questions_list.to_frame().to_excel(output_file, index=False)
160
  else:
161
  return "No questions provided.", None
162
 
163
  return "Processing complete. Download the file below.", output_file
 
164
 
165
  text_list = []
166
 
 
144
  if file is not None:
145
  # Read questions from the uploaded Excel file
146
  try:
147
+ df = pd.read_excel(file, engine='openpyxl')
148
  except Exception as e:
149
  return f"Failed to read Excel file: {e}", None
150
 
 
152
  if df.shape[1] != 1:
153
  return "The uploaded file must contain only one column of questions.", None
154
 
155
+ # Extract the first column
156
  questions_list = df.iloc[:, 0]
157
 
158
+ # Generate prompts for each question
159
+ prompts_list = questions_list.apply(generate_prompts)
160
+
161
+ # Combine the questions and prompts into a DataFrame
162
+ output_df = pd.DataFrame({
163
+ 'Questions': questions_list,
164
+ 'Generated Prompts': prompts_list
165
+ })
166
+
167
+ # Save the DataFrame to a new Excel file
168
  output_file = "processed_questions.xlsx"
169
+ output_df.to_excel(output_file, index=False)
170
  else:
171
  return "No questions provided.", None
172
 
173
  return "Processing complete. Download the file below.", output_file
174
+ ```
175
 
176
  text_list = []
177