Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -120,12 +120,27 @@ with gr.Blocks() as demo:
|
|
| 120 |
outputs=output_box
|
| 121 |
)
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
feedback_button.click(
|
| 124 |
-
|
| 125 |
-
# lambda *args: hf_writer.flag(args),
|
| 126 |
inputs=[prompt_box, output_box, feedback_box],
|
| 127 |
-
outputs=status_text
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
# gr.Interface(lambda x:x, "text", "text", allow_flagging="manual", flagging_callback=hf_writer)
|
| 131 |
|
|
|
|
| 120 |
outputs=output_box
|
| 121 |
)
|
| 122 |
|
| 123 |
+
def submit_feedback(prompt, generated_text, feedback):
|
| 124 |
+
data = {
|
| 125 |
+
"prompt": prompt,
|
| 126 |
+
"generated_text": generated_text,
|
| 127 |
+
"feedback": feedback
|
| 128 |
+
}
|
| 129 |
+
hf_writer.flag(data)
|
| 130 |
+
return "Feedback submitted."
|
| 131 |
+
|
| 132 |
feedback_button.click(
|
| 133 |
+
submit_feedback,
|
|
|
|
| 134 |
inputs=[prompt_box, output_box, feedback_box],
|
| 135 |
+
outputs=status_text
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
+
# feedback_button.click(
|
| 139 |
+
# hf_writer.flag([prompt_box,output_box,feedback_box]),
|
| 140 |
+
# # lambda *args: hf_writer.flag(args),
|
| 141 |
+
# inputs=[prompt_box, output_box, feedback_box],
|
| 142 |
+
# outputs=status_text,
|
| 143 |
+
# )
|
| 144 |
|
| 145 |
# gr.Interface(lambda x:x, "text", "text", allow_flagging="manual", flagging_callback=hf_writer)
|
| 146 |
|