Amirizaniani commited on
Commit
6762f17
·
verified ·
1 Parent(s): 8e85ee2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -156,9 +156,11 @@ def process_inputs(llm, file, relevance, diversity):
156
  # Extract the first column
157
  questions_list = df.iloc[:, 0]
158
 
 
159
  # Initialize lists to store the expanded data
160
  expanded_questions = []
161
  expanded_prompts = []
 
162
 
163
  # Generate prompts for each question and expand the data
164
  for question in questions_list:
@@ -166,10 +168,15 @@ def process_inputs(llm, file, relevance, diversity):
166
  expanded_questions.extend([question] * len(prompts))
167
  expanded_prompts.extend(prompts)
168
 
 
 
 
 
169
  # Combine the expanded data into a DataFrame
170
  output_df = pd.DataFrame({
171
  'Questions': expanded_questions,
172
- 'Generated Prompts': expanded_prompts
 
173
  })
174
 
175
  # Save the DataFrame to a new Excel file
@@ -295,8 +302,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
295
  ("Alpaca", "TheBloke/LeoScorpius-GreenNode-Alpaca-7B-v1-GGUF")],
296
  label="Large Language Model")
297
  file_upload = gr.File(label="Upload an Excel File with Questions", file_types=[".xlsx"])
298
- relevance_slider = gr.Slider(0, 100, value=70, step=1, label="Relevance")
299
- diversity_slider = gr.Slider(0, 100, value=25, step=1, label="Diversity")
 
 
300
 
301
  submit_button = gr.Button("Submit")
302
  output_textbox = gr.Textbox(label="Output")
 
156
  # Extract the first column
157
  questions_list = df.iloc[:, 0]
158
 
159
+ # Initialize lists to store the expanded data
160
  # Initialize lists to store the expanded data
161
  expanded_questions = []
162
  expanded_prompts = []
163
+ expanded_answers = []
164
 
165
  # Generate prompts for each question and expand the data
166
  for question in questions_list:
 
168
  expanded_questions.extend([question] * len(prompts))
169
  expanded_prompts.extend(prompts)
170
 
171
+ # Generate answers for each prompt
172
+ answers = [answer_question(prompt) for prompt in prompts]
173
+ expanded_answers.extend(answers)
174
+
175
  # Combine the expanded data into a DataFrame
176
  output_df = pd.DataFrame({
177
  'Questions': expanded_questions,
178
+ 'Generated Prompts': expanded_prompts,
179
+ 'Answers': expanded_answers
180
  })
181
 
182
  # Save the DataFrame to a new Excel file
 
302
  ("Alpaca", "TheBloke/LeoScorpius-GreenNode-Alpaca-7B-v1-GGUF")],
303
  label="Large Language Model")
304
  file_upload = gr.File(label="Upload an Excel File with Questions", file_types=[".xlsx"])
305
+ with gr.Row():
306
+ Relevance = gr.Slider(1, 100, value=70, label="Relevance", info="Choose between 0 and 100", interactive=True)
307
+ Diversity = gr.Slider(1, 100, value=25, label="Diversity", info="Choose between 0 and 100", interactive=True)
308
+
309
 
310
  submit_button = gr.Button("Submit")
311
  output_textbox = gr.Textbox(label="Output")