| import gradio as gr |
| from transformers import pipeline |
|
|
|
|
| question_answerer = pipeline("question-answering", model="shashankheg/my_qa_model") |
|
|
|
|
| def QA(Context,Question): |
| result=question_answerer(context=Context,question=Question) |
| for answer in result: |
| return result['answer'] |
|
|
| |
| interface = gr.Interface(fn =QA, |
| inputs = ['text','text'], |
| outputs=['text'], |
| title= 'Qustion Answering using Distilbert', |
| theme = gr.themes.Glass(), |
| examples = [ |
| ['On February 6, 2016, one day before her performance at the Super Bowl, Beyoncé released a new single exclusively on music streaming service Tidal called "Formation"','When did Beyoncé release Formation?'], |
| ['Special bundles of the game contain a Wolf Link Amiibo figurine, which unlocks a Wii U-exclusive dungeon called the "Cave of Shadows" and can carry data over to the upcoming 2016 Zelda game. Other Zelda-related Amiibo figurines have distinct functions: Link and Toon Link replenish arrows, Zelda and Sheik restore Link\'s health, and Ganondorf causes Link to take twice as much damage.','What characters will be able to replenish arrows?'], |
|
|
| ], |
| |
| css = """" |
| body {background-color: #FFCCCB}""" |
| |
| ) |
| |
| |
| interface.launch() |
|
|