Spaces:
Runtime error
Runtime error
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() |