multi-label / app.py
winain7788's picture
fix bug
ea3f038
raw
history blame
454 Bytes
import gradio as gr
import torch
from transformers import pipeline
device = 0 if torch.cuda.is_available() else -1
sentiment_pipeline = pipeline("text-classification",
model="winain7788/bert-finetuned-sem_eval-english",
device=device)
async def get_sentiment(text):
return sentiment_pipeline([text])
demo = gr.Interface(fn=get_sentiment, inputs="text", outputs="list")
demo.launch()