Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -41,8 +41,8 @@ def crear_indice():
|
|
41 |
|
42 |
def load_qa_model():
|
43 |
|
44 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
45 |
-
model =
|
46 |
return tokenizer, model
|
47 |
|
48 |
# 4. Use streamlit to create a web app
|
@@ -118,7 +118,11 @@ def main():
|
|
118 |
|
119 |
if ('?' in query):
|
120 |
st.write("Contestando a: ", query)
|
121 |
-
text=
|
|
|
|
|
|
|
|
|
122 |
inputs = tokenizer(query, text, return_tensors='tf')
|
123 |
outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
|
124 |
answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
|
|
|
41 |
|
42 |
def load_qa_model():
|
43 |
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained('dccuchile/bert-base-spanish-wwm-cased', use_fast="false")
|
45 |
+
model = AutoModelForQuestionAnswering.from_pretrained("Lisibonny/modelo_qa_beto_squad", from_pt=True)
|
46 |
return tokenizer, model
|
47 |
|
48 |
# 4. Use streamlit to create a web app
|
|
|
118 |
|
119 |
if ('?' in query):
|
120 |
st.write("Contestando a: ", query)
|
121 |
+
text="""
|
122 |
+
El director de la Corporaci贸n de Acueductos y Alcantarillado de Santiago (Coraasan), Andr茅s Burgos, inform贸 ayer que un equipo realiz贸 un levantamiento
|
123 |
+
de los da帽os causados por la explosi贸n de una tuber铆a de agua en el sector Bella Vista, para asumir totalmente los gastos de rehabilitaci贸n y amueblamiento
|
124 |
+
de la vivienda afectada.
|
125 |
+
"""
|
126 |
inputs = tokenizer(query, text, return_tensors='tf')
|
127 |
outputs = qa_model(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'])
|
128 |
answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
|