Spaces:
Sleeping
Sleeping
| #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() |