multi-label / app.py
winain7788's picture
change model
4d20f8e
raw
history blame
442 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="3728km/fined-tune-thai-sentiment",
device=device)
async def get_sentiment(text):
return sentiment_pipeline(text)
demo = gr.Interface(fn=get_sentiment, inputs="text", outputs="json")
demo.launch()