Spaces:
Runtime error
Runtime error
File size: 706 Bytes
e1195f6 f44b6d9 1b497f2 0086049 1b497f2 bd190f2 eacb599 bd190f2 090a6eb 8ba75ae 0086049 eacb599 0086049 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import TextClassificationPipeline
from shiny import App, Inputs
def classification(input: Inputs):
model_name = 'lincoln/flaubert-mlsum-topic-classification'
loaded_tokenizer = AutoTokenizer.from_pretrained(model_name)
loaded_model = AutoModelForSequenceClassification.from_pretrained(model_name)
nlp = TextClassificationPipeline(model=loaded_model, tokenizer=loaded_tokenizer)
result = nlp(Inputs, truncation=True)
print(result)
return result
if "main" in "__main__":
print('Processing')
Inputs = "Le Bayern Munich prend la grenadine."
classification(Inputs)
|