Spaces:
Runtime error
Runtime error
update ui
Browse files75 unmodified lines7677787980818213 unmodified lines969798991001016 unmodified lines1081091101111121138 unmodified lines12212312412512612712812913013113213313413513613713813914014114214314414517 unmodified lines16316416516616716816917016 unmodified lines18718818919019119219375 unmodified linesline_generators = {dataset: line_generator(dataset) for dataset in datasets}def send_report(sample, dataset, reason, annotator):text = sample["text"]sample.pop("text")13 unmodified lines"metadata": sample,"reason": reason,"annotator": annotator,"timestamp": str(datetime.now()),})6 unmodified lines"metadata": sample,"reason": reason,"annotator": annotator,"timestamp": str(datetime.now()),})8 unmodified lines)if __name__ == "__main__":demo = gr.Blocks()with demo:current_sample_state = gr.State(dict())with gr.Row():annotator = gr.Textbox(lines=1,max_lines=1,placeholder="Type your name here if you'd like it to be recorded.",label="Annotator",)with gr.Row():dataset = gr.Dropdown(choices=datasets,value="Pick a dataset below",label="Dataset",)with gr.Row():reason_txt = gr.Textbox(17 unmodified linesgr.update(visible=True),]def bad_line(current_sample, dataset, reason, annotator):send_report(current_sample, dataset, reason, annotator)next_line = next(line_generators[dataset])return ["<pre>" + next_line["text"] + "</pre>",16 unmodified lines)bad_btn.click(bad_line,inputs=[current_sample_state, dataset, reason_txt, annotator],outputs=[text, reason_txt, current_sample_state],)75 unmodified lines7677787980818213 unmodified lines969798991001011026 unmodified lines1091101111121131141158 unmodified lines12412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615717 unmodified lines17517617717817918018118216 unmodified lines19920020120220320420575 unmodified linesline_generators = {dataset: line_generator(dataset) for dataset in datasets}def send_report(sample, dataset, reason, annotator, campaign):text = sample["text"]sample.pop("text")13 unmodified lines"metadata": sample,"reason": reason,"annotator": annotator,"campaign": campaign,"timestamp": str(datetime.now()),})6 unmodified lines"metadata": sample,"reason": reason,"annotator": annotator,"campaign": campaign,"timestamp": str(datetime.now()),})8 unmodified lines)description = """GecLM annotations. All annotations are recorded in the [data_feedback](https://huggingface.co/datasets/HuggingFaceGECLM/data_feedback) dataset."""if __name__ == "__main__":demo = gr.Blocks()with demo:current_sample_state = gr.State(dict())description = gr.Markdown(value=description)with gr.Row():annotator = gr.Textbox(lines=1,max_lines=1,placeholder="Optionally provide your name here if you'd like it to be recorded.",label="Annotator",)campaign = gr.Textbox(lines=1,max_lines=1,placeholder="Optionally provide the name of the annotation campagin for ease of filtering the reports.",label="Annotation campaign",)with gr.Row():dataset = gr.Dropdown(choices=datasets, value="Pick a dataset below", label="Dataset",)with gr.Row():reason_txt = gr.Textbox(17 unmodified linesgr.update(visible=True),]def bad_line(current_sample, dataset, reason, annotator, campaign):send_report(current_sample, dataset, reason, annotator, campaign)next_line = next(line_generators[dataset])return ["<pre>" + next_line["text"] + "</pre>",16 unmodified lines)bad_btn.click(bad_line,inputs=[current_sample_state, dataset, reason_txt, annotator, campaign],outputs=[text, reason_txt, current_sample_state],)
app.py+20-8