legacy107 commited on
Commit
79221a5
1 Parent(s): 4734baf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -144,11 +144,11 @@ def retrieve_context(question, contexts):
144
  # Define your function to generate answers
145
  def generate_answer(question, context, ground, do_pretrained, do_natural, do_pretrained_natural):
146
  contexts = chunk_splitter(clean_data(context))
147
- context = retrieve_context(question, contexts)
148
- ground_in_context = ground in context
149
 
150
  # Combine question and context
151
- input_text = f"question: {question} context: {context}"
152
 
153
  # Tokenize the input text
154
  input_ids = tokenizer(
@@ -183,7 +183,7 @@ def generate_answer(question, context, ground, do_pretrained, do_natural, do_pre
183
  if do_pretrained_natural:
184
  pretrained_paraphrased_answer = paraphrase_answer(question, generated_answer, True)
185
 
186
- return generated_answer, paraphrased_answer, ground_in_context, pretrained_answer, pretrained_paraphrased_answer, context
187
 
188
 
189
  # Define a function to list examples from the dataset
 
144
  # Define your function to generate answers
145
  def generate_answer(question, context, ground, do_pretrained, do_natural, do_pretrained_natural):
146
  contexts = chunk_splitter(clean_data(context))
147
+ retrieved_context = retrieve_context(question, contexts)
148
+ ground_in_context = ground in retrieved_context
149
 
150
  # Combine question and context
151
+ input_text = f"question: {question} context: {retrieved_context}"
152
 
153
  # Tokenize the input text
154
  input_ids = tokenizer(
 
183
  if do_pretrained_natural:
184
  pretrained_paraphrased_answer = paraphrase_answer(question, generated_answer, True)
185
 
186
+ return generated_answer, paraphrased_answer, ground_in_context, pretrained_answer, pretrained_paraphrased_answer, retrieved_context
187
 
188
 
189
  # Define a function to list examples from the dataset