Spaces:
Sleeping
Sleeping
Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
qa_pipeline = pipeline("text2text-generation", model="your-username/cv-qa-model")
|
| 5 |
+
|
| 6 |
+
def answer_question(question):
|
| 7 |
+
prompt = f"Question: {question}\nAnswer as Peramanathan Sathyamoorthy in a concise, conversational tone:"
|
| 8 |
+
response = qa_pipeline(prompt, max_length=150, do_sample=True, temperature=0.7)[0]['generated_text']
|
| 9 |
+
return response.replace("Question:", "").replace("Answer as Peramanathan Sathyamoorthy in a concise, conversational tone:", "").strip()
|
| 10 |
+
|
| 11 |
+
gr.Interface(fn=answer_question, inputs="text", outputs="text").launch()
|