Asif555355's picture
Update app.py
561fe14
import gradio as gr
from transformers import pipeline
title = 'Question Answering demo with BERT-BASE-CASED and Gradio'
context = "Bangladesh, situated in South Asia, is known for its rich cultural heritage and natural beauty. With a population of over 160 million, it's one of the most densely populated countries globally. The nation has made significant strides in various sectors, including agriculture, textiles, and the technology industry. Dhaka, the capital city, is a bustling metropolis, while the Sundarbans mangrove forest, a UNESCO World Heritage Site, is home to the Royal Bengal Tiger. Despite economic challenges, Bangladesh has made substantial progress in improving healthcare and education, contributing to its social development and global recognition."
question = "What is the name of the mangrove forest?"
question_answerer = pipeline("question-answering", model='deepset/bert-base-cased-squad2')
#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()