Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -92,23 +92,69 @@ Allocation:
|
|
| 92 |
Interventional Model:
|
| 93 |
Masking:"""
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
)
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
Interventional Model:
|
| 93 |
Masking:"""
|
| 94 |
|
| 95 |
+
hf_writer = gr.HuggingFaceDatasetSaver("criteria-feedback-demo",token, private=True)
|
| 96 |
+
with gr.Blocks() as demo:
|
| 97 |
+
with gr.Row():
|
| 98 |
+
with gr.Column():
|
| 99 |
+
prompt_box = gr.Textbox(
|
| 100 |
+
label="Research Information",
|
| 101 |
+
placeholder=place_holder,
|
| 102 |
+
value=prefilled_value,
|
| 103 |
+
lines=10)
|
| 104 |
+
submit_button = gr.Button("Generate")
|
| 105 |
+
with gr.Column():
|
| 106 |
+
output_box = gr.Textbox(
|
| 107 |
+
label="Eligiblecriteria Criteria",
|
| 108 |
+
lines=21,
|
| 109 |
+
interactive=False)
|
| 110 |
+
with gr.Row():
|
| 111 |
+
with gr.Column():
|
| 112 |
+
feedback_box = gr.Textbox(label="Enter your feedback here...", lines=3, interactive=True)
|
| 113 |
+
feedback_button = gr.Button("Submit Feedback")
|
| 114 |
+
status_text = gr.Textbox(label="Status", lines=1, interactive=False)
|
| 115 |
+
|
| 116 |
+
submit_button.click(
|
| 117 |
+
run_model_on_text,
|
| 118 |
+
inputs=prompt_box,
|
| 119 |
+
outputs=output_box
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
feedback_button.click(
|
| 123 |
+
lambda *args: hf_writer.flag(args),
|
| 124 |
+
inputs=[prompt_box, output_box, feedback_box],
|
| 125 |
+
outputs=status_text,
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# gr.Interface(lambda x:x, "text", "text", allow_flagging="manual", flagging_callback=hf_writer)
|
| 129 |
+
|
| 130 |
+
# feedback_button.click(
|
| 131 |
+
# save_feedback,
|
| 132 |
+
# inputs=[prompt_box, output_box, feedback_box],
|
| 133 |
+
# outputs=status_text
|
| 134 |
+
# )
|
| 135 |
+
|
| 136 |
+
demo.launch()
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
#----------------------------------
|
| 141 |
+
# prompt_box = gr.Textbox(
|
| 142 |
+
# lines=25,
|
| 143 |
+
# label="Research Information",
|
| 144 |
+
# placeholder=place_holder,
|
| 145 |
+
# value=prefilled_value,
|
| 146 |
+
# )
|
| 147 |
+
|
| 148 |
+
# output_box = gr.Textbox(
|
| 149 |
+
# lines=25,
|
| 150 |
+
# label="Eligiblecriteria Criteria",
|
| 151 |
+
# )
|
| 152 |
+
|
| 153 |
+
# demo = gr.Interface(
|
| 154 |
+
# fn=run_model_on_text,
|
| 155 |
+
# inputs=prompt_box,
|
| 156 |
+
# outputs=output_box,
|
| 157 |
+
# allow_flagging='auto',
|
| 158 |
+
# )
|
| 159 |
+
|
| 160 |
+
# demo.queue(max_size=20).launch(debug=True, share=True)
|