Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 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()
|