Spaces:
Runtime error
Runtime error
Download app.py from jaimin/Open_Domain_QA: direct link, hf CLI and curl.
- Browser
- Download file 600 Bytes
-
https://huggingface.co/spaces/jaimin/Open_Domain_QA/resolve/main/app.py
- Command line
-
hf download hf://spaces/jaimin/Open_Domain_QA/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jaimin/Open_Domain_QA/resolve/main/app.py
600 Bytes
| from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline | |
| import gradio as gr | |
| # Creating the Q&A pipeline | |
| nlp = pipeline('question-answering', model='jaimin/QA', tokenizer='jaimin/QA') | |
| def questionAndAnswer(ques,content): | |
| question_set = {'question':ques,'context':content} | |
| results = nlp(question_set) | |
| return results['answer'] | |
| interface = gr.Interface(fn=questionAndAnswer, | |
| inputs=["text","text"], | |
| outputs="text", | |
| title='Question&Answer') | |
| interface.launch(inline=False) |