Spaces:
Running
Running
crowdsource flags to hf dataset
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from __future__ import print_function, division, unicode_literals
|
|
3 |
import gradio as gr
|
4 |
|
5 |
import sys
|
|
|
6 |
from os.path import abspath, dirname
|
7 |
|
8 |
import json
|
@@ -14,6 +15,9 @@ from emoji import emojize
|
|
14 |
|
15 |
from huggingface_hub import hf_hub_download
|
16 |
|
|
|
|
|
|
|
17 |
model_name = "Uberduck/torchmoji"
|
18 |
model_path = hf_hub_download(repo_id=model_name, filename="pytorch_model.bin")
|
19 |
vocab_path = hf_hub_download(repo_id=model_name, filename="vocabulary.json")
|
@@ -102,8 +106,10 @@ gradio_app = gr.Interface(
|
|
102 |
live=True,
|
103 |
title="π DeepMoji π",
|
104 |
allow_duplication=True,
|
|
|
105 |
allow_flagging="manual",
|
106 |
-
flagging_options=["sarcasm/innuendo π", "
|
|
|
107 |
)
|
108 |
|
109 |
if __name__ == "__main__":
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
import sys
|
6 |
+
import os
|
7 |
from os.path import abspath, dirname
|
8 |
|
9 |
import json
|
|
|
15 |
|
16 |
from huggingface_hub import hf_hub_download
|
17 |
|
18 |
+
HF_TOKEN = os.getenv('HF_TOKEN')
|
19 |
+
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "crowdsourced-deepmoji-flags")
|
20 |
+
|
21 |
model_name = "Uberduck/torchmoji"
|
22 |
model_path = hf_hub_download(repo_id=model_name, filename="pytorch_model.bin")
|
23 |
vocab_path = hf_hub_download(repo_id=model_name, filename="vocabulary.json")
|
|
|
106 |
live=True,
|
107 |
title="π DeepMoji π",
|
108 |
allow_duplication=True,
|
109 |
+
# flagged saved to hf dataset
|
110 |
allow_flagging="manual",
|
111 |
+
flagging_options=["'π© sarcasm / innuendo π'", "'π© unsuitable / other'"],
|
112 |
+
flagging_callback=hf_writer
|
113 |
)
|
114 |
|
115 |
if __name__ == "__main__":
|