File size: 1,162 Bytes
26e9b2a
 
 
 
 
 
561fe14
26e9b2a
 
 
 
 
 
 
 
 
21d32d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()