ccibeekeoc42 commited on
Commit
d086f71
·
verified ·
1 Parent(s): 3a6553a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -10
app.py CHANGED
@@ -3,6 +3,7 @@ import torch
3
  from transformers import pipeline
4
 
5
  # Loading the TTS and Vocoder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
6
  import re
7
  import json
8
  import inflect
@@ -45,16 +46,27 @@ if not os.path.exists('yarngpt'):
45
  else:
46
  print("YarnGPT repository already exists")
47
 
48
- # Install required packages
49
- print("Installing required packages...")
50
- run_command("pip install -q outetts uroman")
51
-
52
- # If you need to install the cloned package in development mode
53
- if os.path.exists('yarngpt'):
54
- os.chdir('yarngpt')
55
- run_command("pip install -e .")
56
- os.chdir('..') # Go back to the original directory
57
-
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  # Download files using Python's requests library instead of !wget
60
  def download_file(url, save_path):
 
3
  from transformers import pipeline
4
 
5
  # Loading the TTS and Vocoder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6
+ import sys
7
  import re
8
  import json
9
  import inflect
 
46
  else:
47
  print("YarnGPT repository already exists")
48
 
49
+ # # Install required packages with specific versions
50
+ # print("Installing required packages with specific versions...")
51
+ # run_command("pip install -q outetts==0.3.3 uroman==1.3.1.1")
52
+
53
+ # Add the yarngpt directory to Python path instead of installing it
54
+ yarngpt_path = os.path.join(os.getcwd(), 'yarngpt')
55
+ if os.path.exists(yarngpt_path) and yarngpt_path not in sys.path:
56
+ sys.path.append(yarngpt_path)
57
+ print(f"Added {yarngpt_path} to Python path")
58
+
59
+ # Now you should be able to import from yarngpt
60
+ # Import this after adding to path
61
+ try:
62
+ from yarngpt.audiotokenizer import AudioTokenizerV2
63
+ print("Successfully imported AudioTokenizerV2 from yarngpt")
64
+ except ImportError as e:
65
+ print(f"Error importing from yarngpt: {e}")
66
+ # Check the content of the directory to debug
67
+ if os.path.exists(yarngpt_path):
68
+ print("Contents of yarngpt directory:")
69
+ print(os.listdir(yarngpt_path))
70
 
71
  # Download files using Python's requests library instead of !wget
72
  def download_file(url, save_path):