Spaces:
Runtime error
Runtime error
Download app.py from antjohns/qa_roberta: direct link, hf CLI and curl.
- Browser
- Download file 430 Bytes
-
https://huggingface.co/spaces/antjohns/qa_roberta/resolve/main/app.py
- Command line
-
hf download hf://spaces/antjohns/qa_roberta/app.py
-
curl -L -o app.py https://huggingface.co/spaces/antjohns/qa_roberta/resolve/main/app.py
430 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| mdl_name = "deepset/roberta-base-squad2" | |
| my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name) | |
| def answer_question(question, context): | |
| inputs = {'question': question, 'context': context} | |
| response = my_pipeline(inputs) | |
| return response['answer'] | |
| gr.Interface(answer_question, inputs=["text", "text"], outputs="text").launch(share=True) | |