Spaces:
Running
Running
Bor Hodošček
commited on
fix: add run button & cleanup
Browse files
app.py
CHANGED
@@ -1,11 +1,24 @@
|
|
1 |
# /// script
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# [tool.marimo.runtime]
|
3 |
# auto_instantiate = false
|
4 |
# ///
|
5 |
|
6 |
import marimo
|
7 |
|
8 |
-
__generated_with = "0.13.
|
9 |
app = marimo.App(width="medium")
|
10 |
|
11 |
|
@@ -93,8 +106,6 @@ def _(mo):
|
|
93 |
language_selector: mo.ui.radio = mo.ui.radio(
|
94 |
options=["English", "Japanese"], value="English", label="Language"
|
95 |
)
|
96 |
-
|
97 |
-
# Return selector and placeholders
|
98 |
return en_placeholder, ja_placeholder, language_selector
|
99 |
|
100 |
|
@@ -118,20 +129,17 @@ def _(
|
|
118 |
full_width=True,
|
119 |
on_change=lambda v: set_text_content(v),
|
120 |
)
|
121 |
-
# Type the return tuple
|
122 |
return current_placeholder, text_input
|
123 |
|
124 |
|
125 |
@app.cell
|
126 |
-
def _(
|
127 |
-
# Type the inner function
|
128 |
def apply_placeholder() -> None:
|
129 |
set_text_content(current_placeholder)
|
130 |
|
131 |
apply_placeholder_button: mo.ui.button = mo.ui.button(
|
132 |
label="Use Placeholder Text", on_click=lambda _: apply_placeholder()
|
133 |
)
|
134 |
-
# Type the return tuple
|
135 |
return (apply_placeholder_button,)
|
136 |
|
137 |
|
@@ -141,8 +149,10 @@ def _(apply_placeholder_button, language_selector, mo, text_input):
|
|
141 |
[
|
142 |
text_input,
|
143 |
mo.hstack([language_selector, apply_placeholder_button], justify="start"),
|
|
|
144 |
]
|
145 |
)
|
|
|
146 |
return
|
147 |
|
148 |
|
@@ -507,7 +517,6 @@ def _(
|
|
507 |
Optional,
|
508 |
Union,
|
509 |
current_text,
|
510 |
-
fix_token,
|
511 |
get_token_stats,
|
512 |
get_tokenizer_info,
|
513 |
get_varied_color,
|
@@ -682,20 +691,7 @@ def _(
|
|
682 |
|
683 |
""")
|
684 |
|
685 |
-
return
|
686 |
-
all_decoded_tokens,
|
687 |
-
token_ids,
|
688 |
-
basic_stats_md,
|
689 |
-
display_limit_reached,
|
690 |
-
length_stats_md,
|
691 |
-
limit_warning,
|
692 |
-
llm_token_data,
|
693 |
-
token_stats,
|
694 |
-
token_viz_html,
|
695 |
-
tokenizer_info,
|
696 |
-
tokenizer_info_md,
|
697 |
-
total_token_count,
|
698 |
-
)
|
699 |
|
700 |
|
701 |
@app.cell
|
|
|
1 |
# /// script
|
2 |
+
# dependencies = [
|
3 |
+
# "marimo>=0.13.0",
|
4 |
+
# "polars==1.29.0",
|
5 |
+
# "altair==5.5.0",
|
6 |
+
# "spacy==3.8.5",
|
7 |
+
# "en-core-web-md",
|
8 |
+
# "ja-core-news-md",
|
9 |
+
# "transformers==4.51.3",
|
10 |
+
# ]
|
11 |
+
#
|
12 |
+
# [tool.uv.sources]
|
13 |
+
# en-core-web-md = { url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.8.0/en_core_web_md-3.8.0-py3-none-any.whl" }
|
14 |
+
# ja-core-news-md = { url = "https://github.com/explosion/spacy-models/releases/download/ja_core_news_md-3.8.0/ja_core_news_md-3.8.0-py3-none-any.whl" }
|
15 |
# [tool.marimo.runtime]
|
16 |
# auto_instantiate = false
|
17 |
# ///
|
18 |
|
19 |
import marimo
|
20 |
|
21 |
+
__generated_with = "0.13.6"
|
22 |
app = marimo.App(width="medium")
|
23 |
|
24 |
|
|
|
106 |
language_selector: mo.ui.radio = mo.ui.radio(
|
107 |
options=["English", "Japanese"], value="English", label="Language"
|
108 |
)
|
|
|
|
|
109 |
return en_placeholder, ja_placeholder, language_selector
|
110 |
|
111 |
|
|
|
129 |
full_width=True,
|
130 |
on_change=lambda v: set_text_content(v),
|
131 |
)
|
|
|
132 |
return current_placeholder, text_input
|
133 |
|
134 |
|
135 |
@app.cell
|
136 |
+
def _(current_placeholder, mo, set_text_content):
|
|
|
137 |
def apply_placeholder() -> None:
|
138 |
set_text_content(current_placeholder)
|
139 |
|
140 |
apply_placeholder_button: mo.ui.button = mo.ui.button(
|
141 |
label="Use Placeholder Text", on_click=lambda _: apply_placeholder()
|
142 |
)
|
|
|
143 |
return (apply_placeholder_button,)
|
144 |
|
145 |
|
|
|
149 |
[
|
150 |
text_input,
|
151 |
mo.hstack([language_selector, apply_placeholder_button], justify="start"),
|
152 |
+
mo.ui.button(label="Analyze"),
|
153 |
]
|
154 |
)
|
155 |
+
|
156 |
return
|
157 |
|
158 |
|
|
|
517 |
Optional,
|
518 |
Union,
|
519 |
current_text,
|
|
|
520 |
get_token_stats,
|
521 |
get_tokenizer_info,
|
522 |
get_varied_color,
|
|
|
691 |
|
692 |
""")
|
693 |
|
694 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
|
696 |
|
697 |
@app.cell
|