Lisibonny commited on
Commit
323c5d9
1 Parent(s): 2228904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -134,8 +134,8 @@ def main():
134
  outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
135
  answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
136
  answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
137
- answer_start_scores = tf.nn.softmax(outputs.start_logits)
138
- answer_end_scores = tf.nn.softmax(outputs.end_logits)
139
  predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
140
  answer=tokenizer.decode(predict_answer_tokens)
141
 
@@ -144,9 +144,9 @@ def main():
144
  # Extract 5 greatest values fo start and end scores with indeces
145
  #answer_start_scores= tf.math.top_k(answer_start_scores, k=5)
146
  #answer_end_scores= tf.math.top_k(answer_end_scores, k=5)
147
- score = answer_start_scores[0]*answer_end_scores[0]
148
- st.write(f'Aqui {answer}' )
149
- st.write(score)
150
  cantidad_respuestas = cantidad_respuestas + 1
151
  df_answer.loc[i, "answer"] = answer
152
  lista_noticias_respuestas.append(df_answer.loc[i].to_frame().T)
 
134
  outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
135
  answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
136
  answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
137
+ #answer_start_scores = tf.nn.softmax(outputs.start_logits)
138
+ #answer_end_scores = tf.nn.softmax(outputs.end_logits)
139
  predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
140
  answer=tokenizer.decode(predict_answer_tokens)
141
 
 
144
  # Extract 5 greatest values fo start and end scores with indeces
145
  #answer_start_scores= tf.math.top_k(answer_start_scores, k=5)
146
  #answer_end_scores= tf.math.top_k(answer_end_scores, k=5)
147
+ #score = answer_start_scores[0]*answer_end_scores[0]
148
+ #st.write(f'Aqui {answer}' )
149
+ #st.write(score)
150
  cantidad_respuestas = cantidad_respuestas + 1
151
  df_answer.loc[i, "answer"] = answer
152
  lista_noticias_respuestas.append(df_answer.loc[i].to_frame().T)