import gradio as gr import tensorflow as tf reloaded_model = tf.saved_model.load("./") def sentiment(text): reloaded_results = tf.sigmoid(reloaded_model(tf.constant([text]))) if reloaded_results[0].numpy()[0] > 0.5: return "Positive" else: return "Negative" iface = gr.Interface(fn=greet, inputs="text", outputs="text") iface.launch()