broadfield-dev commited on
Commit
79af715
·
verified ·
1 Parent(s): 320726b

Update app_logic.py

Browse files
Files changed (1) hide show
  1. app_logic.py +10 -7
app_logic.py CHANGED
@@ -3,6 +3,8 @@ import re
3
  import tempfile
4
  import shutil
5
  import git
 
 
6
  from huggingface_hub import (
7
  create_repo,
8
  upload_folder,
@@ -58,15 +60,16 @@ def load_token_from_image_and_set_env(image_pil_object: Image.Image, password: s
58
  except Exception as e: status_messages_display.append(f"**Unexpected decoding error:** {str(e)}")
59
  return "\n".join(status_messages_display)
60
 
61
- def process_commented_markdown(lines):
62
 
63
- """Process a commented markdown string by stripping '# ' from each line if any line starts with '# # Space:'."""
64
- if any(line.strip().startswith(("# # Space:", "# Space:")) for line in lines):
65
- print("FOUND ALT MARKDOWN")
 
 
 
66
  cleaned_lines = [line.lstrip("# ") for line in lines]
67
- return cleaned_lines
68
-
69
- return lines
70
 
71
 
72
  # --- `parse_markdown` (Unchanged from previous corrected version) ---
 
3
  import tempfile
4
  import shutil
5
  import git
6
+ import re
7
+
8
  from huggingface_hub import (
9
  create_repo,
10
  upload_folder,
 
60
  except Exception as e: status_messages_display.append(f"**Unexpected decoding error:** {str(e)}")
61
  return "\n".join(status_messages_display)
62
 
 
63
 
64
+ def process_commented_markdown(commented_input):
65
+ """Process a commented markdown string by stripping '# ' from each line if it matches the expected format."""
66
+ # Check for '# # Space:' at the start or within the input
67
+ if re.search(r'^\s*#+\s*Space:', commented_input, re.MULTILINE):
68
+ lines = commented_input.strip().split("\n")
69
+ # Strip '# ' from each line
70
  cleaned_lines = [line.lstrip("# ") for line in lines]
71
+ return "\n".join(cleaned_lines)
72
+ return commented_input
 
73
 
74
 
75
  # --- `parse_markdown` (Unchanged from previous corrected version) ---