import gradio as gr from transformers import pipeline title = 'Question Answering demo with transformers and gradio' context = "The Amazon rainforest (Portuguese: Floresta AmazĂ´nica or Amterritory belof the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and wituador, Bolivia, Guyana, Suriname, and French Guiana. States or departments in four nations contain 'Amazonas' in their 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." question = "Which name is also used to describe the Amazon rainforest in English?" from datasets import load_dataset dataset = load_dataset("ToonTownTommy/Ttt") question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad') #result = question_answerer(question = question, context=context) #return result['answer'] interface = gr.Interface.from_pipeline(question_answerer, title = title, theme = "peach", examples = [[context, question]]).launch()