xiaopeiwu commited on
Commit
2097e81
·
1 Parent(s): 44293e3

allow flagging

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -6,6 +6,7 @@ import gradio as gr
6
 
7
  MODEL_PATH = "xiaopeiwu/hrw_v2"
8
  auth_token = os.environ.get("TOKEN_FROM_SECRET")
 
9
  model = DistilBertForSequenceClassification.from_pretrained(MODEL_PATH, use_auth_token=auth_token)
10
  tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
11
 
@@ -29,6 +30,9 @@ demo = gr.Interface(
29
  description="DistilBert for text classification model fine tuned on 70% of annotated RM production data combined with industry-specific webscrape data",
30
  inputs=gr.Textbox(placeholder="Enter sentence here and press Submit", label="Sentence to check"),
31
  outputs="textbox",
 
 
 
32
  )
33
 
34
  demo.launch()
 
6
 
7
  MODEL_PATH = "xiaopeiwu/hrw_v2"
8
  auth_token = os.environ.get("TOKEN_FROM_SECRET")
9
+ hf_writer = gr.HuggingFaceDatasetSaver(auth_token, "hrw_v2_test_flagged_data")
10
  model = DistilBertForSequenceClassification.from_pretrained(MODEL_PATH, use_auth_token=auth_token)
11
  tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
12
 
 
30
  description="DistilBert for text classification model fine tuned on 70% of annotated RM production data combined with industry-specific webscrape data",
31
  inputs=gr.Textbox(placeholder="Enter sentence here and press Submit", label="Sentence to check"),
32
  outputs="textbox",
33
+ allow_flagging="manual",
34
+ flagging_options=["wrong result", "inconsistent result", "debatable input", "other"],
35
+ flagging_callback=hf_writer,
36
  )
37
 
38
  demo.launch()