Spaces:
Running
Running
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipeline = pipeline(task="emoji-prediction", model="Uberduck/torchmoji")
|
5 |
+
|
6 |
+
def predict(deepmoji_analysis):
|
7 |
+
predictions = pipeline(deepmoji_analysis)
|
8 |
+
return deepmoji_analysis, {p["label"]: p["score"] for p in predictions}
|
9 |
+
|
10 |
+
gradio_app = gr.Interface(fn=predict, inputs="text", outputs="text")
|
11 |
+
|
12 |
+
if __name__ == "__main__":
|
13 |
+
gradio_app.launch()
|