multi-label / app.py
winain7788's picture
change model
6f8a72b
raw
history blame
452 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="json")
demo.launch()