Actual-Innocence commited on
Commit
8af4f63
·
verified ·
1 Parent(s): 58625f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -185,15 +185,20 @@ def download_default_samples():
185
  audio_path = f"{SAMPLE_DIR}/{name}.wav"
186
  text_path = f"{SAMPLE_DIR}/{name}.txt"
187
 
188
- if not os.path.exists(audio_path):
 
189
  try:
190
- print(f"📥 Downloading {name} sample...")
191
  response = requests.get(urls["audio"], timeout=60)
 
192
  with open(audio_path, 'wb') as f:
193
  f.write(response.content)
194
 
 
195
  with open(text_path, 'w') as f:
196
  f.write(urls["text"])
 
 
197
 
198
- finally:
199
- print(finished)
 
185
  audio_path = f"{SAMPLE_DIR}/{name}.wav"
186
  text_path = f"{SAMPLE_DIR}/{name}.txt"
187
 
188
+ if not os.path.exists(audio_path):
189
+ print(f"📥 Downloading {name} sample...")
190
  try:
191
+ # Download audio
192
  response = requests.get(urls["audio"], timeout=60)
193
+ response.raise_for_status() # Check for download errors
194
  with open(audio_path, 'wb') as f:
195
  f.write(response.content)
196
 
197
+ # Write text
198
  with open(text_path, 'w') as f:
199
  f.write(urls["text"])
200
+
201
+ print(f"✅ Finished downloading {name}.") # <-- Corrected line
202
 
203
+ except requests.exceptions.RequestException as e:
204
+ print(f"❌ Failed to download {name}: {e}"))