Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def image_classifier(inp):
|
| 5 |
+
pipe = pipeline(task='text-classification', model='s-nlp/russian_toxicity_classifier')
|
| 6 |
+
out = pipe(inp)
|
| 7 |
+
a = json.dumps(out[0])
|
| 8 |
+
return a
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=image_classifier, inputs="text", outputs="label")
|
| 11 |
+
demo.launch(server_port=11459, debug=True)
|