Spaces:
Running
Running
File size: 591 Bytes
745fb2d 193652a 8bf10d5 292dc31 8bf10d5 292dc31 |
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 |
#Import and install libraries
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
import tensorflow_text as tf_text
import tensorflow_hub as hub
import gradio as gr
#Import model
model = tf.keras.models.load_model('detect_LLM_colab_method2')
#Function that predicts for a given text
def LLM_text(Text):
prediction = model.predict([Text])
output_text = 'Your text is {}% likely to be a LLM generated.'.format(round(prediction[0][0]*100, 2))
return output_text
iface = gr.Interface(fn=LLM_text, inputs="text", outputs="text")
iface.launch() |