File size: 405 Bytes
a4141e2 30b9217 ea35202 a4141e2 40afb62 23117a0 a4141e2 62c9b7f a4141e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
import tensorflow as tf
import tensorflow_text as text
reloaded_model = tf.saved_model.load("./imdb_bert")
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() |