File size: 1,108 Bytes
589fe9a
 
60935fc
 
 
 
 
 
589fe9a
60935fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
import os

os.system("pip install gradio==3.11")
os.system("pip install transformers")
os.system("pip install torch")

import requests
import gradio as gr




from transformers import pipeline

qa_model = pipeline("question-answering")



def question(context,question):
    output = qa_model(question = question, context = context)
    return output['answer']
    
demo = gr.Interface(
    fn=question,
    inputs=[gr.Textbox(lines=8, placeholder="context Here..."), gr.Textbox(lines=2, placeholder="question Here...")],
    outputs="text",title="Question answering app",
    description="This is a question answering app, it can prove useful when you want to extract an information from a large text. All you need to do is copy and paste the text you want to query and then query it with a relevant question",
    examples=[
        ["My name is Oluwafunbi Adeneye and I attended Federal University of Agriculture Abeokuta", "What is the name of Oluwafunbi's school?"],
        ["Cocoa house is the tallest building in Ibadan","what is the name of the tallest building in Ibadan?"],
    ],
)
demo.launch()