Spaces:
Runtime error
Runtime error
Save feedback
Browse files
app.py
CHANGED
|
@@ -25,11 +25,12 @@ def save_data(data):
|
|
| 25 |
def save_feedback(feedback_rating, feedback_text):
|
| 26 |
global latest_obfuscation
|
| 27 |
if latest_obfuscation:
|
| 28 |
-
|
|
|
|
| 29 |
"rating": feedback_rating,
|
| 30 |
"text": feedback_text
|
| 31 |
}
|
| 32 |
-
save_data(
|
| 33 |
|
| 34 |
def greet(input_text, length, function_words, grade_level, sarcasm, formality, voice, persuasive, descriptive, narrative, expository):
|
| 35 |
global latest_obfuscation, user_id
|
|
@@ -103,7 +104,7 @@ with demo:
|
|
| 103 |
gr.Markdown("# 1) Input Text\n### Enter the text to be obfuscated.")
|
| 104 |
input_text = gr.Textbox(
|
| 105 |
label="Input Text",
|
| 106 |
-
|
| 107 |
)
|
| 108 |
gr.Markdown("# 2) Style Element Sliders\n### Adjust the style element sliders to the desired levels to steer the obfuscation.")
|
| 109 |
|
|
@@ -165,23 +166,13 @@ with demo:
|
|
| 165 |
|
| 166 |
# Add thumbs up / thumbs down
|
| 167 |
gr.Markdown("### Is the response good or bad?")
|
| 168 |
-
feedback_rating = gr.Radio(choices=["No Feedback Selected", "Good π", "Bad π"], value="
|
| 169 |
|
| 170 |
# Add feedback box
|
| 171 |
gr.Markdown("### Provide any feedback on the obfuscation")
|
| 172 |
feedback_text = gr.Textbox(label="Feedback", lines=3)
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
fn=save_feedback,
|
| 177 |
-
inputs=[feedback_rating, feedback_text],
|
| 178 |
-
outputs=[]
|
| 179 |
-
)
|
| 180 |
-
|
| 181 |
-
feedback_text.change(
|
| 182 |
-
fn=save_feedback,
|
| 183 |
-
inputs=[feedback_rating, feedback_text],
|
| 184 |
-
outputs=[]
|
| 185 |
-
)
|
| 186 |
|
| 187 |
demo.launch()
|
|
|
|
| 25 |
def save_feedback(feedback_rating, feedback_text):
|
| 26 |
global latest_obfuscation
|
| 27 |
if latest_obfuscation:
|
| 28 |
+
feedback_data = latest_obfuscation.copy()
|
| 29 |
+
feedback_data['feedback'] = {
|
| 30 |
"rating": feedback_rating,
|
| 31 |
"text": feedback_text
|
| 32 |
}
|
| 33 |
+
save_data(feedback_data)
|
| 34 |
|
| 35 |
def greet(input_text, length, function_words, grade_level, sarcasm, formality, voice, persuasive, descriptive, narrative, expository):
|
| 36 |
global latest_obfuscation, user_id
|
|
|
|
| 104 |
gr.Markdown("# 1) Input Text\n### Enter the text to be obfuscated.")
|
| 105 |
input_text = gr.Textbox(
|
| 106 |
label="Input Text",
|
| 107 |
+
placeholder="The quick brown fox jumped over the lazy dogs."
|
| 108 |
)
|
| 109 |
gr.Markdown("# 2) Style Element Sliders\n### Adjust the style element sliders to the desired levels to steer the obfuscation.")
|
| 110 |
|
|
|
|
| 166 |
|
| 167 |
# Add thumbs up / thumbs down
|
| 168 |
gr.Markdown("### Is the response good or bad?")
|
| 169 |
+
feedback_rating = gr.Radio(choices=["No Feedback Selected", "Good π", "Bad π"], value="No Feedback Selected", interactive=True, label="Rate the Response")
|
| 170 |
|
| 171 |
# Add feedback box
|
| 172 |
gr.Markdown("### Provide any feedback on the obfuscation")
|
| 173 |
feedback_text = gr.Textbox(label="Feedback", lines=3)
|
| 174 |
|
| 175 |
+
save_feedback_button = gr.Button("Save Feedback")
|
| 176 |
+
save_feedback_button.click(fn=save_feedback, inputs=[feedback_rating, feedback_text], outputs=[])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
demo.launch()
|