Spaces:
Runtime error
Runtime error
Commit Β·
6774b13
1
Parent(s): e12a5db
Update app.py
Browse files
app.py
CHANGED
|
@@ -129,11 +129,11 @@ def generate_phrases_for_words(wordlist, mode):
|
|
| 129 |
yield " ".join(combo)
|
| 130 |
|
| 131 |
# ============================================================
|
| 132 |
-
# Scan Function
|
| 133 |
# ============================================================
|
| 134 |
|
| 135 |
def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
| 136 |
-
start_index, end_index, passphrase):
|
| 137 |
|
| 138 |
if not os.path.exists(addresses_file):
|
| 139 |
return f"β File nahi mili: {addresses_file}", ""
|
|
@@ -142,6 +142,7 @@ def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
|
| 142 |
start_index = int(start_index)
|
| 143 |
end_index = int(end_index)
|
| 144 |
|
|
|
|
| 145 |
try:
|
| 146 |
known = load_addresses_cached(addresses_file)
|
| 147 |
except Exception as e:
|
|
@@ -175,6 +176,7 @@ def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
|
| 175 |
total_phrases = len(phrases)
|
| 176 |
|
| 177 |
for p_idx, phrase in enumerate(phrases, 1):
|
|
|
|
| 178 |
log_text += f"\nπ [{p_idx}/{total_phrases}] Checking: {phrase}\n"
|
| 179 |
words = phrase.strip().split()
|
| 180 |
|
|
@@ -183,7 +185,6 @@ def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
|
| 183 |
continue
|
| 184 |
|
| 185 |
for idx in range(start_index, end_index + 1):
|
| 186 |
-
log_text += f" - Index {idx}...\n"
|
| 187 |
for phrase_str in generate_phrases_for_words(words, phrase_mode):
|
| 188 |
if not is_valid_bip39(phrase_str):
|
| 189 |
continue
|
|
@@ -208,7 +209,7 @@ def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
|
| 208 |
return log_text, matches_text
|
| 209 |
|
| 210 |
# ============================================================
|
| 211 |
-
# Simple, Flat UI (No
|
| 212 |
# ============================================================
|
| 213 |
with gr.Blocks(title="Phrase Scanner") as demo:
|
| 214 |
gr.Markdown("# π Phrase Scanner")
|
|
@@ -245,6 +246,7 @@ with gr.Blocks(title="Phrase Scanner") as demo:
|
|
| 245 |
inputs=[my_phrase, num_phrases, addresses_file, phrase_mode,
|
| 246 |
start_index, end_index, passphrase],
|
| 247 |
outputs=[log_output, matches_output],
|
|
|
|
| 248 |
)
|
| 249 |
|
| 250 |
# ZeroGPU requirement
|
|
|
|
| 129 |
yield " ".join(combo)
|
| 130 |
|
| 131 |
# ============================================================
|
| 132 |
+
# Scan Function WITH Progress Bar
|
| 133 |
# ============================================================
|
| 134 |
|
| 135 |
def run_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
|
| 136 |
+
start_index, end_index, passphrase, progress=gr.Progress()):
|
| 137 |
|
| 138 |
if not os.path.exists(addresses_file):
|
| 139 |
return f"β File nahi mili: {addresses_file}", ""
|
|
|
|
| 142 |
start_index = int(start_index)
|
| 143 |
end_index = int(end_index)
|
| 144 |
|
| 145 |
+
progress(0, desc="Addresses load ho rahe hain...")
|
| 146 |
try:
|
| 147 |
known = load_addresses_cached(addresses_file)
|
| 148 |
except Exception as e:
|
|
|
|
| 176 |
total_phrases = len(phrases)
|
| 177 |
|
| 178 |
for p_idx, phrase in enumerate(phrases, 1):
|
| 179 |
+
progress((p_idx - 1) / total_phrases, desc=f"Phrase {p_idx}/{total_phrases}...")
|
| 180 |
log_text += f"\nπ [{p_idx}/{total_phrases}] Checking: {phrase}\n"
|
| 181 |
words = phrase.strip().split()
|
| 182 |
|
|
|
|
| 185 |
continue
|
| 186 |
|
| 187 |
for idx in range(start_index, end_index + 1):
|
|
|
|
| 188 |
for phrase_str in generate_phrases_for_words(words, phrase_mode):
|
| 189 |
if not is_valid_bip39(phrase_str):
|
| 190 |
continue
|
|
|
|
| 209 |
return log_text, matches_text
|
| 210 |
|
| 211 |
# ============================================================
|
| 212 |
+
# Simple, Flat UI (No Layout Bugs)
|
| 213 |
# ============================================================
|
| 214 |
with gr.Blocks(title="Phrase Scanner") as demo:
|
| 215 |
gr.Markdown("# π Phrase Scanner")
|
|
|
|
| 246 |
inputs=[my_phrase, num_phrases, addresses_file, phrase_mode,
|
| 247 |
start_index, end_index, passphrase],
|
| 248 |
outputs=[log_output, matches_output],
|
| 249 |
+
show_progress="full"
|
| 250 |
)
|
| 251 |
|
| 252 |
# ZeroGPU requirement
|