Spaces:
Runtime error
Runtime error
File size: 692 Bytes
eaad231 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-classification", model="Bruno/intent-classification-pt-setfit-model")
dictionary={'48':'alarm_set',
'46':'audio_volume_mute',
'1':'iot_hue_lightchange',
'40':'iot_hue_lightoff',
'34':'iot_cleaning',
}
def greet(text, dictionary=dictionary):
response = pipe(text)
return dictionary[response[0]['label']]
demo = gr.Interface(fn=greet,
inputs="text",
outputs="text",
title="Aamzon PT-br Intent Classifier",
description="Aamzon PT-br Intent Classifier",
examples=[["pausa por dez segundos"],["definir a iluminação adequada para leitura"],["aspirar a casa"]]
cache_examples=False)
demo.launch() |