Spaces:
Build error
Build error
Download app.py from krrishD/deepset_roberta-base-squad2: direct link, hf CLI and curl.
- Browser
- Download file 892 Bytes
-
https://huggingface.co/spaces/krrishD/deepset_roberta-base-squad2/resolve/main/app.py
- Command line
-
hf download hf://spaces/krrishD/deepset_roberta-base-squad2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/krrishD/deepset_roberta-base-squad2/resolve/main/app.py
892 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("question-answering", model="deepset/roberta-base-squad2") | |
| def main(question, context): | |
| answer = pipe(question=question, context=context) | |
| return answer["answer"] | |
| with gr.Blocks() as demo: | |
| gr.Markdown("""# Question Answerer!""") | |
| with gr.Row(): | |
| with gr.Column(): | |
| text1 = gr.Textbox( | |
| label="Question", | |
| lines=1, | |
| value="Who does Cristiano Ronaldo play for?", | |
| ) | |
| text2 = gr.Textbox( | |
| label="Context", | |
| lines=3, | |
| value="Cristiano Ronaldo is a player for Manchester United", | |
| ) | |
| output = gr.Textbox() | |
| b1 = gr.Button("Ask Question!") | |
| b1.click(main, inputs=[text1, text2], outputs=output) | |
| gr.Markdown("""#### powered by [Tassle](https://bit.ly/3LXMklV)""") | |
| if __name__ == "__main__": | |
| demo.launch() |