File size: 595 Bytes
0410efb
4de1365
0410efb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()