databoyface commited on
Commit
ab0f10a
·
verified ·
1 Parent(s): d00ff32

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(task="text-classification", model="databoyface/distilbert-base-cased-ome-v4.2")
5
+
6
+ def predict(input_txt):
7
+ predictions = pipeline(input_txt)
8
+ return {p["label"] for p in predictions}
9
+
10
+ gradio_app = gr.Interface(
11
+ fn=predict,
12
+ inputs=["text"],
13
+ outputs=["text"],
14
+ title="How do you feel?",
15
+ )
16
+
17
+ if __name__ == "__main__":
18
+ gradio_app.launch()