File size: 1,584 Bytes
f162045
 
 
 
 
 
 
0cd2422
 
f162045
 
 
 
 
 
 
 
0cd2422
 
 
 
 
 
 
f162045
 
0cd2422
f162045
0cd2422
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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()