Spaces:
Runtime error
Runtime error
import gradio | |
from src.models.bert import BERTClassifier | |
from src.utils.utilities import Utility | |
model = BERTClassifier(model_name='Bert_GoEmotions_4Epochs.model') | |
classes = Utility().read_emotion_list() | |
def predict(sentence): | |
print(sentence) | |
predictions = model.evaluate([sentence]) | |
print(f"Predictions: {predictions}") | |
return classes[predictions[0]] | |
gradio.Interface( | |
fn=predict, | |
inputs="text", | |
outputs="text", | |
allow_flagging='auto', | |
flagging_dir='logs', | |
flagging_callback=gradio.SimpleCSVLogger(), | |
).launch() | |