Spaces:
Runtime error
Runtime error
File size: 575 Bytes
01f65eb ce6c474 01f65eb a6ff391 01f65eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio
from src.models.bert import BERTClassifier
from src.utils.utilities import Utility
model = BERTClassifier(model_name='jeevavijay10/nlp-goemotions-bert')
classes = Utility().read_emotion_list()
def predict(inputSentence):
print(inputSentence)
predictions = model.evaluate([inputSentence])
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()
|