Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update: Display review for 'No tasting notes detected'
Browse files
app.py
CHANGED
|
@@ -119,8 +119,7 @@ def _render_cleanup_html(cleanup_meta):
|
|
| 119 |
"""
|
| 120 |
Renders cleanup_meta into HTML with struck-through non-note sentences.
|
| 121 |
"""
|
| 122 |
-
html_out = "<
|
| 123 |
-
html_out += "<p>"
|
| 124 |
|
| 125 |
for s in cleanup_meta:
|
| 126 |
sent = html.escape(s.get("sentence", ""))
|
|
@@ -183,10 +182,12 @@ def predict(review_raw: str, do_cleanup: bool):
|
|
| 183 |
# Display cleanup visualization based on detected content
|
| 184 |
if review_status == "mixed":
|
| 185 |
# Show which parts were kept vs. removed
|
|
|
|
| 186 |
html_info_out += _render_cleanup_html(cleanup_meta)
|
| 187 |
elif review_status == "noise_only":
|
| 188 |
# No tasting notes detected in the text
|
| 189 |
html_info_out += "<strong>No tasting notes detected</strong>"
|
|
|
|
| 190 |
else: # review_status == "review_only"
|
| 191 |
# Text consists entirely of tasting notes; no cleanup needed
|
| 192 |
html_info_out += "<strong>No cleanup was necessary</strong>"
|
|
|
|
| 119 |
"""
|
| 120 |
Renders cleanup_meta into HTML with struck-through non-note sentences.
|
| 121 |
"""
|
| 122 |
+
html_out = "<p>"
|
|
|
|
| 123 |
|
| 124 |
for s in cleanup_meta:
|
| 125 |
sent = html.escape(s.get("sentence", ""))
|
|
|
|
| 182 |
# Display cleanup visualization based on detected content
|
| 183 |
if review_status == "mixed":
|
| 184 |
# Show which parts were kept vs. removed
|
| 185 |
+
html_info_out = "<strong>Your text has been cleaned up</strong>"
|
| 186 |
html_info_out += _render_cleanup_html(cleanup_meta)
|
| 187 |
elif review_status == "noise_only":
|
| 188 |
# No tasting notes detected in the text
|
| 189 |
html_info_out += "<strong>No tasting notes detected</strong>"
|
| 190 |
+
html_info_out += _render_cleanup_html(cleanup_meta)
|
| 191 |
else: # review_status == "review_only"
|
| 192 |
# Text consists entirely of tasting notes; no cleanup needed
|
| 193 |
html_info_out += "<strong>No cleanup was necessary</strong>"
|