Francisco Santos commited on
Commit
f594e45
1 Parent(s): 913172d

flagged files saving

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -371,6 +371,9 @@ def process_files(html_file, json_file):
371
  #return '\n'.join(map(str, html_classified_lines))
372
  return '\n'.join(map(str, json_classified_lines))
373
 
 
 
 
374
  iface = gr.Interface(fn=process_files,
375
  inputs=[gr.Textbox(lines = 20, max_lines = 1000, label="Upload HTML File"), gr.Textbox(lines = 20, max_lines = 1000, label="Upload JSON File")],
376
  outputs=gr.Textbox(lines = 20, max_lines = 1000, label="Output"),
@@ -380,6 +383,7 @@ iface = gr.Interface(fn=process_files,
380
  [example3, solution3],
381
  ],
382
  allow_flagging="manual",
 
383
  )
384
 
385
 
 
371
  #return '\n'.join(map(str, html_classified_lines))
372
  return '\n'.join(map(str, json_classified_lines))
373
 
374
+ HF_TOKEN = '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'
375
+ hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "form_matcher_demo_flagged")
376
+
377
  iface = gr.Interface(fn=process_files,
378
  inputs=[gr.Textbox(lines = 20, max_lines = 1000, label="Upload HTML File"), gr.Textbox(lines = 20, max_lines = 1000, label="Upload JSON File")],
379
  outputs=gr.Textbox(lines = 20, max_lines = 1000, label="Output"),
 
383
  [example3, solution3],
384
  ],
385
  allow_flagging="manual",
386
+ flagging_callback=hf_writer
387
  )
388
 
389