import gradio as gr from transformers import AutoModelForSequenceClassification, AutoTokenizer, TextClassificationPipeline tokenizer = AutoTokenizer.from_pretrained("daspartho/anime-or-not") model = AutoModelForSequenceClassification.from_pretrained("daspartho/anime-or-not") # i've uploaded the model on HuggingFace :) label_map = { 'LABEL_0':"That's not Anime enough!", 'LABEL_1':"That's an Anime!", } pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer) def classify_text(plot): return label_map[pipe(plot)[0]['label']] iface = gr.Interface( description = "Write a plot, and the model will determine whether it's anime enough", article = "

Github

", fn=classify_text, inputs=gr.inputs.Textbox(label="Type the plot here",), outputs=gr.outputs.Textbox(label='What the model thinks'), enable_queue=True, ) iface.launch()