Spaces:
Sleeping
Sleeping
Update app.py
Browse filesTest HuggingFaceDatasetSaver
app.py
CHANGED
|
@@ -95,46 +95,46 @@ Masking:"""
|
|
| 95 |
|
| 96 |
|
| 97 |
hf_writer = gr.HuggingFaceDatasetSaver("criteria-feedback-demo",token_w, private=True)
|
| 98 |
-
with gr.Blocks() as demo:
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
|
| 139 |
# feedback_button.click(
|
| 140 |
# hf_writer.flag([prompt_box,output_box,feedback_box]),
|
|
@@ -151,28 +151,31 @@ with gr.Blocks() as demo:
|
|
| 151 |
# outputs=status_text
|
| 152 |
# )
|
| 153 |
|
| 154 |
-
demo.launch()
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
#----------------------------------
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
hf_writer = gr.HuggingFaceDatasetSaver("criteria-feedback-demo",token_w, private=True)
|
| 98 |
+
# with gr.Blocks() as demo:
|
| 99 |
+
# with gr.Row():
|
| 100 |
+
# with gr.Column():
|
| 101 |
+
# prompt_box = gr.Textbox(
|
| 102 |
+
# label="Research Information",
|
| 103 |
+
# placeholder=place_holder,
|
| 104 |
+
# value=prefilled_value,
|
| 105 |
+
# lines=10)
|
| 106 |
+
# submit_button = gr.Button("Generate")
|
| 107 |
+
# with gr.Column():
|
| 108 |
+
# output_box = gr.Textbox(
|
| 109 |
+
# label="Eligiblecriteria Criteria",
|
| 110 |
+
# lines=21,
|
| 111 |
+
# interactive=False)
|
| 112 |
+
# with gr.Row():
|
| 113 |
+
# with gr.Column():
|
| 114 |
+
# feedback_box = gr.Textbox(label="Enter your feedback here...", lines=3, interactive=True)
|
| 115 |
+
# feedback_button = gr.Button("Submit Feedback")
|
| 116 |
+
# status_text = gr.Textbox(label="Status", lines=1, interactive=False)
|
| 117 |
+
|
| 118 |
+
# submit_button.click(
|
| 119 |
+
# run_model_on_text,
|
| 120 |
+
# inputs=prompt_box,
|
| 121 |
+
# outputs=output_box
|
| 122 |
+
# )
|
| 123 |
+
|
| 124 |
+
# def submit_feedback(prompt, generated_text, feedback):
|
| 125 |
+
# data = {
|
| 126 |
+
# "prompt": prompt,
|
| 127 |
+
# "generated_text": generated_text,
|
| 128 |
+
# "feedback": feedback
|
| 129 |
+
# }
|
| 130 |
+
# hf_writer.flag(data)
|
| 131 |
+
# return "Feedback submitted."
|
| 132 |
+
|
| 133 |
+
# feedback_button.click(
|
| 134 |
+
# submit_feedback,
|
| 135 |
+
# inputs=[prompt_box, output_box, feedback_box],
|
| 136 |
+
# outputs=status_text
|
| 137 |
+
# )
|
| 138 |
|
| 139 |
# feedback_button.click(
|
| 140 |
# hf_writer.flag([prompt_box,output_box,feedback_box]),
|
|
|
|
| 151 |
# outputs=status_text
|
| 152 |
# )
|
| 153 |
|
| 154 |
+
# demo.launch()
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
#----------------------------------
|
| 159 |
+
prompt_box = gr.Textbox(
|
| 160 |
+
lines=25,
|
| 161 |
+
label="Research Information",
|
| 162 |
+
placeholder=place_holder,
|
| 163 |
+
value=prefilled_value,
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
output_box = gr.Textbox(
|
| 167 |
+
lines=25,
|
| 168 |
+
label="Eligiblecriteria Criteria",
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
demo = gr.Interface(
|
| 172 |
+
fn=run_model_on_text,
|
| 173 |
+
inputs=prompt_box,
|
| 174 |
+
outputs=output_box,
|
| 175 |
+
allow_flagging="manual",
|
| 176 |
+
flagging_options=["incorrect", "inappropriate", "appropriate"],
|
| 177 |
+
flagging_callback=hf_writer
|
| 178 |
+
)
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
demo.queue(max_size=20).launch(debug=True, share=True)
|