Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,6 @@ def crear_indice():
|
|
44 |
def load_qa_model():
|
45 |
|
46 |
tokenizer = AutoTokenizer.from_pretrained('dccuchile/bert-base-spanish-wwm-cased', use_fast="false")
|
47 |
-
#model = AutoModelForQuestionAnswering.from_pretrained("Lisibonny/modelo_qa_beto_squad")
|
48 |
model = TFAutoModelForQuestionAnswering.from_pretrained("Lisibonny/modelo_qa_beto_squad")
|
49 |
return tokenizer, model
|
50 |
|
@@ -129,6 +128,7 @@ def main():
|
|
129 |
text=df.loc[i, "resumen"]
|
130 |
inputs = tokenizer(query, text, return_tensors='tf')
|
131 |
outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
|
|
|
132 |
answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
|
133 |
answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
|
134 |
predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
|
|
|
44 |
def load_qa_model():
|
45 |
|
46 |
tokenizer = AutoTokenizer.from_pretrained('dccuchile/bert-base-spanish-wwm-cased', use_fast="false")
|
|
|
47 |
model = TFAutoModelForQuestionAnswering.from_pretrained("Lisibonny/modelo_qa_beto_squad")
|
48 |
return tokenizer, model
|
49 |
|
|
|
128 |
text=df.loc[i, "resumen"]
|
129 |
inputs = tokenizer(query, text, return_tensors='tf')
|
130 |
outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
|
131 |
+
st.markdown(outputs)
|
132 |
answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
|
133 |
answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
|
134 |
predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
|