import gradio as gr from transformers import pipeline qa_model = pipeline("question-answering", "timpal0l/mdeberta-v3-base-squad2") description=""" A resume question-answering interface where a recruter can ask the user about their achievements and skills without the need to interact with them directly or the need to read a really long resume **LIMITATIONS:** the bot can only extract specific information and does not take into account multiple sentences at once. """ examples = ["what's your name?", "what's your email adress ?", "what did you study ?","are you open for work?","what are your skills ?","what's your most recent experience ?"] with open("context.txt","r") as f: # read content from the resume context = f.read() def chat(question,history): """chat with the QA pipeline""" return qa_model(question = question, context = context)["answer"].strip() demo = gr.ChatInterface(fn=chat, examples=examples, title="Resume QA",description=description) demo.launch()