add warning message and increase n words
This commit is contained in:
@@ -208,7 +208,7 @@ def _(client, mo, model_select, pd, start_processing_btn, tags_df):
|
||||
return (df,)
|
||||
|
||||
|
||||
@app.cell
|
||||
@app.cell(hide_code=True)
|
||||
def _(KEYWORDS_FPATH, KEYWORD_FREQ_FPATH, df, mo, pd, start_processing_btn):
|
||||
mo.stop(not start_processing_btn.value, "Click button above to process first")
|
||||
|
||||
@@ -252,15 +252,19 @@ def _(KEYWORDS_FPATH, KEYWORD_FREQ_FPATH, df, mo, pd, start_processing_btn):
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
# 4b) [optional] Load data from `keyword_frequencies_*.xlsx`
|
||||
def _(KEYWORD_FREQ_FPATH, mo):
|
||||
mo.md(rf"""
|
||||
# 4b) [optional] Load data from `keyword_frequencies_{KEYWORD_FREQ_FPATH.name}`
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(KEYWORD_FREQ_FPATH, mo):
|
||||
def _(KEYWORD_FREQ_FPATH, mo, start_processing_btn):
|
||||
if start_processing_btn is not None: # Triggers re-execution of this cell when keyword extraction completes
|
||||
pass
|
||||
|
||||
|
||||
load_existing_btn = None
|
||||
if KEYWORD_FREQ_FPATH.exists():
|
||||
load_existing_btn = mo.ui.run_button(label=f"Load keywords from `{KEYWORD_FREQ_FPATH.name}`")
|
||||
@@ -370,24 +374,30 @@ def _(mo, table_selection):
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(KEYWORD_FREQ_FPATH, frequency_df, remove_rows_btn, table_selection):
|
||||
def _(KEYWORD_FREQ_FPATH, frequency_df, mo, remove_rows_btn, table_selection):
|
||||
_s = None
|
||||
if remove_rows_btn is not None and remove_rows_btn.value:
|
||||
# get selected rows
|
||||
selected_rows = table_selection.value
|
||||
if len(selected_rows) >0 :
|
||||
rows_to_drop = table_selection.value.index.tolist()
|
||||
try:
|
||||
frequency_df.drop(index=rows_to_drop, inplace=True, axis=0)
|
||||
except KeyError:
|
||||
_s = mo.callout("GO TO STEP 4b) and reload data to continue refining the dataset.", kind='warn')
|
||||
else:
|
||||
# Save updated frequencies back to xlsx
|
||||
frequency_df.to_excel(
|
||||
KEYWORD_FREQ_FPATH,
|
||||
index=False
|
||||
)
|
||||
|
||||
frequency_df.drop(index=rows_to_drop, inplace=True, axis=0)
|
||||
print(f"Updated keyword frequencies saved to: `{KEYWORD_FREQ_FPATH}`")
|
||||
|
||||
# Save updated frequencies back to xlsx
|
||||
frequency_df.to_excel(
|
||||
KEYWORD_FREQ_FPATH,
|
||||
index=False
|
||||
)
|
||||
# mo.callout(f"Updated keyword frequencies saved to: `{KEYWORD_FREQ_FPATH}`", kind="success")
|
||||
_s = mo.callout("GO TO STEP 4b) and reload data to continue refining the dataset.", kind='warn')
|
||||
|
||||
print(f"Updated keyword frequencies saved to: `{KEYWORD_FREQ_FPATH}`")
|
||||
|
||||
print("GO TO STEP 4b) and reload data to continue refining the dataset.")
|
||||
_s
|
||||
return
|
||||
|
||||
|
||||
@@ -522,7 +532,7 @@ def _(
|
||||
width=canvas_size[0],
|
||||
height=canvas_size[1],
|
||||
max_font_size=100, # Increased font size for larger canvas
|
||||
max_words=20, # Increased word count to fill space
|
||||
max_words=40, # Increased word count to fill space
|
||||
color_func=blue_color_func,
|
||||
mask=chase_mask, # Apply the circular mask
|
||||
contour_width=0,
|
||||
@@ -536,7 +546,7 @@ def _(
|
||||
width=canvas_size[0],
|
||||
height=canvas_size[1],
|
||||
max_font_size=150, # Increased font size for larger canvas
|
||||
max_words=20, # Increased word count to fill space
|
||||
max_words=40, # Increased word count to fill space
|
||||
color_func=blue_color_func,
|
||||
# mask=chase_mask, # Apply the circular mask
|
||||
# contour_width=0,
|
||||
|
||||
Reference in New Issue
Block a user