gradsyntax commited on
Commit
f5c2dbe
·
verified ·
1 Parent(s): 7404cad

created app

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
2
+ import gradio as gr
3
+
4
+ # Load pre-trained model and tokenizer
5
+ model_name = "ferrazzipaulo/biobert-drug-interactions"
6
+ pipe = pipeline("text-classification", model=model_name)
7
+
8
+ def predict_drug_interaction(text):
9
+ result = pipe(text)
10
+ return result[0]['label'], result[0]['score']
11
+
12
+ demo = gr.Interface(
13
+ fn=predict_drug_interaction,
14
+ inputs=gr.Textbox(label="Enter a biomedical sentence"),
15
+ outputs=[
16
+ gr.Label(label="Prediction"),
17
+ gr.Number(label="Confidence Score")
18
+ ],
19
+ title="Drug Interaction Predictor",
20
+ description="Detects whether two drugs are likely to interact based on biomedical text."
21
+ )
22
+
23
+ demo.launch()