Spaces:
Sleeping
Sleeping
Download app.py from Peramanathan/cvqa: direct link, hf CLI and curl.
- Browser
- Download file 597 Bytes
-
https://huggingface.co/spaces/Peramanathan/cvqa/resolve/main/app.py
- Command line
-
hf download hf://spaces/Peramanathan/cvqa/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Peramanathan/cvqa/resolve/main/app.py
597 Bytes
| 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() | |