Spaces:
Runtime error
Runtime error
File size: 718 Bytes
e74b5ef f7d01d2 e74b5ef f7d01d2 96c93ae e74b5ef f7d01d2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("FuriouslyAsleep/unhappyZebra100")
model = AutoModelForSequenceClassification.from_pretrained("FuriouslyAsleep/unhappyZebra100")
def greet(name):
inputs = tokenizer(name, return_tensors="pt")
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
print(predictions)
# return "Hello " + name + "!!"
return "Probabilities are listed here (False prob, then True prob): " + predictions
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
|