WUJUNCHAO commited on
Commit
5273fda
1 Parent(s): 9b1388d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,7 +1,12 @@
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 gradio as gr
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline("text-classification", model="roberta-base-openai-detector")
 
5
 
6
+ def greet(text):
7
+ data = pipe(text)[0]
8
+ label = data["label"]
9
+ score = data["score"]
10
+ return f"The text is {label}, with {score} confidence score@"
11
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
12
  iface.launch()