Funbi/Quest
0
1import os2 3os.system("pip install gradio==3.11")4os.system("pip install transformers")5os.system("pip install torch")6 7import requests8import gradio as gr9 10 11 12 13from transformers import pipeline14 15qa_model = pipeline("question-answering")16 17 18 19def question(context,question):20 output = qa_model(question = question, context = context)21 return output['answer']22 23demo = gr.Interface(24 fn=question,25 inputs=[gr.Textbox(lines=8, placeholder="context Here..."), gr.Textbox(lines=2, placeholder="question Here...")],26 outputs="text",title="Question answering app",27 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",28 examples=[29 ["My name is Oluwafunbi Adeneye and I attended Federal University of Agriculture Abeokuta", "What is the name of Oluwafunbi's school?"],30 ["Cocoa house is the tallest building in Ibadan","what is the name of the tallest building in Ibadan?"],31 ],32)33demo.launch()34 