ashishkblink commited on
Commit
c63b8eb
·
verified ·
1 Parent(s): b80f570

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -29,6 +29,8 @@ possible_parent_paths = [
29
  ]
30
 
31
  f5_tts_imported = False
 
 
32
  for parent_path in possible_parent_paths:
33
  parent_path = os.path.abspath(parent_path)
34
  f5_tts_path = os.path.join(parent_path, "f5_tts")
@@ -44,7 +46,15 @@ for parent_path in possible_parent_paths:
44
  print(f"✅ Successfully imported f5_tts from {parent_path}")
45
  break
46
  except ImportError as e:
47
- print(f"⚠️ Tried {parent_path}, but import failed: {e}")
 
 
 
 
 
 
 
 
48
  continue
49
 
50
  if not f5_tts_imported:
@@ -68,11 +78,15 @@ if not f5_tts_imported:
68
  else:
69
  print(f" ❌ f5_tts directory NOT found")
70
 
 
 
71
  raise ImportError(
72
  f"Could not import f5_tts. Please ensure the model code is available.\n"
73
  f"Current directory: {current_dir}\n"
74
  f"Looking for f5_tts in: {current_dir}\n"
75
- f"Python path: {sys.path[:3]}"
 
 
76
  )
77
 
78
  # Model configuration
 
29
  ]
30
 
31
  f5_tts_imported = False
32
+ import_error_details = []
33
+
34
  for parent_path in possible_parent_paths:
35
  parent_path = os.path.abspath(parent_path)
36
  f5_tts_path = os.path.join(parent_path, "f5_tts")
 
46
  print(f"✅ Successfully imported f5_tts from {parent_path}")
47
  break
48
  except ImportError as e:
49
+ error_msg = str(e)
50
+ import_error_details.append(f"{parent_path}: {error_msg}")
51
+ print(f"⚠️ Tried {parent_path}, but import failed: {error_msg}")
52
+ # Continue trying other paths
53
+ continue
54
+ except Exception as e:
55
+ error_msg = str(e)
56
+ import_error_details.append(f"{parent_path}: {type(e).__name__}: {error_msg}")
57
+ print(f"⚠️ Tried {parent_path}, but error occurred: {error_msg}")
58
  continue
59
 
60
  if not f5_tts_imported:
 
78
  else:
79
  print(f" ❌ f5_tts directory NOT found")
80
 
81
+ error_summary = "\n".join(import_error_details) if import_error_details else "No import attempts made"
82
+
83
  raise ImportError(
84
  f"Could not import f5_tts. Please ensure the model code is available.\n"
85
  f"Current directory: {current_dir}\n"
86
  f"Looking for f5_tts in: {current_dir}\n"
87
+ f"Python path: {sys.path[:3]}\n"
88
+ f"Import errors:\n{error_summary}\n"
89
+ f"If you see 'No module named X', add it to requirements.txt"
90
  )
91
 
92
  # Model configuration