Download app.py from hagara/Medical-Question-Answering-System: direct link, hf CLI and curl.
- Browser
- Download file 595 Bytes
-
https://huggingface.co/spaces/hagara/Medical-Question-Answering-System/resolve/main/app.py
- Command line
-
hf download hf://spaces/hagara/Medical-Question-Answering-System/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hagara/Medical-Question-Answering-System/resolve/main/app.py
595 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the question-answering pipeline | |
| pipe = pipeline("question-answering", model="hagara/biobert-qa") | |
| # Define the interface | |
| def qa_interface(context, question): | |
| result = pipe(question=question, context=context) | |
| answer = result["answer"] | |
| return answer | |
| # Create the Gradio interface | |
| iface = gr.Interface( | |
| fn=qa_interface, | |
| inputs=["text", "text"], | |
| outputs="text", | |
| title="Medical Question-Answering Interface", | |
| description="Ask a question related to medical case", | |
| ) | |
| # Launch the interface | |
| iface.launch() | |