Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,12 +88,11 @@ def handle_magic_click(current_text, current_button_text):
|
|
| 88 |
if current_button_text == "Reset":
|
| 89 |
# Reset to initial state
|
| 90 |
return (
|
| 91 |
-
gr.update(value="", elem_classes="", interactive=True), # text_area - reset and unlock
|
| 92 |
"", # previous_text_area - clear
|
| 93 |
gr.update(visible=False), # previous_text_area visibility - hide
|
| 94 |
gr.update(value="", visible=False), # category_label - hide
|
| 95 |
-
gr.update(value="Magic Button")
|
| 96 |
-
"Your Text" # text_area label - reset
|
| 97 |
)
|
| 98 |
|
| 99 |
result = magic_function(current_text)
|
|
@@ -112,7 +111,7 @@ def handle_magic_click(current_text, current_button_text):
|
|
| 112 |
current_text, # previous_text_area - store current
|
| 113 |
gr.update(visible=False), # previous_text_area visibility - hide
|
| 114 |
gr.update(value=f"**{category_fix}**", visible=True), # category_label - show category in bold
|
| 115 |
-
gr.update(value="Reset")
|
| 116 |
)
|
| 117 |
else:
|
| 118 |
# Non-compliant case - show suggestion, show previous text, show category
|
|
@@ -121,7 +120,7 @@ def handle_magic_click(current_text, current_button_text):
|
|
| 121 |
current_text, # previous_text_area - store current
|
| 122 |
gr.update(visible=True), # previous_text_area visibility - show
|
| 123 |
gr.update(value=f"**{category_fix}**", visible=True), # category_label - show category in bold
|
| 124 |
-
gr.update(value="Magic Button")
|
| 125 |
)
|
| 126 |
|
| 127 |
|
|
|
|
| 88 |
if current_button_text == "Reset":
|
| 89 |
# Reset to initial state
|
| 90 |
return (
|
| 91 |
+
gr.update(label="Your Text", value="", elem_classes="", interactive=True), # text_area - reset and unlock
|
| 92 |
"", # previous_text_area - clear
|
| 93 |
gr.update(visible=False), # previous_text_area visibility - hide
|
| 94 |
gr.update(value="", visible=False), # category_label - hide
|
| 95 |
+
gr.update(value="Magic Button") # button text - reset
|
|
|
|
| 96 |
)
|
| 97 |
|
| 98 |
result = magic_function(current_text)
|
|
|
|
| 111 |
current_text, # previous_text_area - store current
|
| 112 |
gr.update(visible=False), # previous_text_area visibility - hide
|
| 113 |
gr.update(value=f"**{category_fix}**", visible=True), # category_label - show category in bold
|
| 114 |
+
gr.update(value="Reset") # button text - change to Reset
|
| 115 |
)
|
| 116 |
else:
|
| 117 |
# Non-compliant case - show suggestion, show previous text, show category
|
|
|
|
| 120 |
current_text, # previous_text_area - store current
|
| 121 |
gr.update(visible=True), # previous_text_area visibility - show
|
| 122 |
gr.update(value=f"**{category_fix}**", visible=True), # category_label - show category in bold
|
| 123 |
+
gr.update(value="Magic Button") # button text - keep as Magic Button
|
| 124 |
)
|
| 125 |
|
| 126 |
|