yugamj commited on
Commit
8bf10d5
1 Parent(s): 43016eb

Updated app.py for text detect app

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -1,7 +1,24 @@
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
+ #Import libraries
2
+ import numpy as np
3
+ import tensorflow as tf
4
+ from tensorflow.keras.models import load_model
5
+ import tensorflow_text as tf_text
6
+ import tensorflow_hub as hub
7
  import gradio as gr
8
 
 
 
9
 
10
+ #Import model
11
+ model = tf.keras.models.load_model('detect_LLM_colab_method2')
12
+
13
+
14
+ #Function that predicts for a given text
15
+ def LLM_text(Text):
16
+ prediction = model.predict([Text])
17
+ output_text = 'Your text is {}% likely to be a LLM generated.'.format(round(prediction[0][0]*100, 2))
18
+
19
+ return output_text
20
+
21
+
22
+
23
+ iface = gr.Interface(fn=LLM_text, inputs="text", outputs="text")
24
  iface.launch()