Pendrokar commited on
Commit
5ff1a7c
β€’
1 Parent(s): 80f1d19

crowdsource flags to hf dataset

Browse files
Files changed (1) hide show
  1. app.py +7 -1
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 😏", "Top # unsuitable/other"]
 
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__":