Quest / app.py
Funbi's picture
Update app.py
589fe9a
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()