Update app.py
Browse files
app.py
CHANGED
@@ -134,18 +134,18 @@ 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 |
|
142 |
if (len(answer)>0):
|
143 |
|
144 |
-
answer_start_scores= tf.math.reduce_sum(answer_start_scores)
|
145 |
-
answer_end_scores= tf.math.reduce_sum(answer_end_scores)
|
146 |
-
score = answer_start_scores*answer_end_scores
|
147 |
-
st.write(f'Aqui {answer_start_scores}' )
|
148 |
-
st.write(answer_end_scores)
|
149 |
cantidad_respuestas = cantidad_respuestas + 1
|
150 |
df_answer.loc[i, "answer"] = answer
|
151 |
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 |
|
142 |
if (len(answer)>0):
|
143 |
|
144 |
+
#answer_start_scores= tf.math.reduce_sum(answer_start_scores)
|
145 |
+
#answer_end_scores= tf.math.reduce_sum(answer_end_scores)
|
146 |
+
#score = answer_start_scores*answer_end_scores
|
147 |
+
#st.write(f'Aqui {answer_start_scores}' )
|
148 |
+
#st.write(answer_end_scores)
|
149 |
cantidad_respuestas = cantidad_respuestas + 1
|
150 |
df_answer.loc[i, "answer"] = answer
|
151 |
lista_noticias_respuestas.append(df_answer.loc[i].to_frame().T)
|