File size: 597 Bytes
bde8a0b
 
 
ddb0990
bde8a0b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from transformers import pipeline
import gradio as gr

qa_pipeline = pipeline("text2text-generation", model="Peramanathan/cv-qa-model")

def answer_question(question):
    prompt = f"Question: {question}\nAnswer as Peramanathan Sathyamoorthy in a concise, conversational tone:"
    response = qa_pipeline(prompt, max_length=150, do_sample=True, temperature=0.7)[0]['generated_text']
    return response.replace("Question:", "").replace("Answer as Peramanathan Sathyamoorthy in a concise, conversational tone:", "").strip()

gr.Interface(fn=answer_question, inputs="text", outputs="text").launch()