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