|
import gradio as gr |
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline |
|
|
|
tokenizer = AutoTokenizer.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459") |
|
model = AutoModelForSequenceClassification.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459") |
|
|
|
|
|
|
|
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) |
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_sentiment(input_text): |
|
return classifier(input_text) |
|
|
|
|
|
iface = gr.Interface( |
|
fn = get_sentiment, |
|
inputs = "text", |
|
outputs = ['text'], |
|
title = 'Silly Name', |
|
description = 'Enter a name. Thing tells you if the name is a silly goblin name, or a respectable human name. For the moment it actually seems to work.', |
|
btn = gr.Button("Run"), |
|
css="app.css", |
|
examples=[ |
|
["Jerimee"], |
|
["Blastnock"], |
|
["Mary"], |
|
["Hwan"], |
|
["Amir"], |
|
["Darnell"], |
|
["Clubrubble"] |
|
] |
|
) |
|
iface.launch() |