text = """Estimado Amazon, la semana pasada pedí una figura de acción de \ Optimus Prime de su tienda online en Alemania. Desafortunadamente, cuando abrí \ el paquete descubrí con horror que me habían enviado una figura de acción de \ Megatron en su lugar. Como enemigo de toda la vida de los Decepticons, espero \ que puedan entender mi dilema. Para resolver el problema, exijo un intercambio \ de Megatron por la figura de Optimus Prime que pedí. Adjunto copias de mis \ registros relacionados con esta compra. Espero tener noticias suyas pronto. \ Sinceramente, Bumblebee.""" mytext1="1. DECLARAR EXTINGUIDA LA ACCIÓN PENAL en este caso por cumplimiento de la suspensión del proceso a prueba, y SOBRESEER a EZEQUIEL CAMILO MARCONNI, DNI 11.222.333, en orden a los delitos de lesiones leves agravadas, amenazas simples y agravadas por el uso de armas, en contra de Chuchita Perez de 50 años." import gradio as gr from transformers import pipeline title = 'Spanish QA - Demo App' #context = "The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname, and French Guiana. States or departments in four nations contain 'Amazonas' in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species." context = text context2 = mytext1 #question = "Which name is also used to describe the Amazon rainforest in English?" question = "¿Qué quiere el cliente?" question2 = "¿Nombre completo de Chuchita?" #question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad') question_answerer = pipeline("question-answering", model="mrm8488/distill-bert-base-spanish-wwm-cased-finetuned-spa-squad2-es") #result = question_answerer(question = question, context=context) #return result['answer'] with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.HTML("