hagara commited on
Commit
0410efb
·
1 Parent(s): 1e41105

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Load the question-answering pipeline
4
+ pipe = pipeline("question-answering", model="hagara/biobert-qa")
5
+
6
+ # Define the interface
7
+ def qa_interface(context, question):
8
+ result = pipe(question=question, context=context)
9
+ answer = result["answer"]
10
+ return answer
11
+
12
+ # Create the Gradio interface
13
+ iface = gr.Interface(
14
+ fn=qa_interface,
15
+ inputs=["text", "text"],
16
+ outputs="text",
17
+ title="Medical Question-Answering Interface",
18
+ description="Ask a question related to medical case",
19
+
20
+ )
21
+
22
+ # Launch the interface
23
+ iface.launch()