Spaces:
Runtime error
Runtime error
import gradio as gr | |
# from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
# import torch | |
# pretrained = "rohanphadke/roberta-finetuned-triplebottomline" | |
# tokenizer = AutoTokenizer.from_pretrained(pretrained) | |
# model = AutoModelForSequenceClassification.from_pretrained(pretrained) | |
# threshold = 0.5 | |
labels = {0: 'people', 1: 'planet', 2:'profit'} | |
return_labels = {'people': 0.25, 'planet':0.5, 'profit':0.75} | |
return_sentiment = {'positive': 0.25, 'neutral':0.5, 'negative':0.75} | |
def greet(name): | |
return "Hello " + name + "!!" | |
def predict_text(text): | |
return return_labels, return_sentiment | |
demo = gr.Interface(fn=predict_text, inputs="text", outputs=["label","label"]) | |
demo.launch() |