mateuseap commited on
Commit
b3fe32a
1 Parent(s): d4704db

feat(app.py): remove google colab checks

Browse files
Files changed (1) hide show
  1. app.py +10 -29
app.py CHANGED
@@ -44,36 +44,17 @@ except (ValueError, TypeError, IndexError):
44
  DoFormant, Quefrency, Timbre = False, 1.0, 1.0
45
  CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
46
 
47
- #from MDXNet import MDXNetDereverb
 
48
 
49
- # Check if we're in a Google Colab environment
50
- if os.path.exists('/content/'):
51
- print("\n-------------------------------\nRVC v2 Easy GUI (Colab Edition)\n-------------------------------\n")
52
-
53
- print("-------------------------------")
54
- # Check if the file exists at the specified path
55
- if os.path.exists('/content/Retrieval-based-Voice-Conversion-WebUI/hubert_base.pt'):
56
- # If the file exists, print a statement saying so
57
- print("File /content/Retrieval-based-Voice-Conversion-WebUI/hubert_base.pt already exists. No need to download.")
58
- else:
59
- # If the file doesn't exist, print a statement saying it's downloading
60
- print("File /content/Retrieval-based-Voice-Conversion-WebUI/hubert_base.pt does not exist. Starting download.")
61
-
62
- # Make a request to the URL
63
- response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt')
64
-
65
- # Ensure the request was successful
66
- if response.status_code == 200:
67
- # If the response was a success, save the content to the specified file path
68
- with open('/content/Retrieval-based-Voice-Conversion-WebUI/hubert_base.pt', 'wb') as f:
69
- f.write(response.content)
70
- print("Download complete. File saved to /content/Retrieval-based-Voice-Conversion-WebUI/hubert_base.pt.")
71
- else:
72
- # If the response was a failure, print an error message
73
- print("Failed to download file. Status code: " + str(response.status_code) + ".")
74
  else:
75
- print("\n-------------------------------\nRVC v2 Easy GUI (Local Edition)\n-------------------------------\n")
76
- print("-------------------------------\nNot running on Google Colab, skipping download.")
 
77
 
78
  def formant_apply(qfrency, tmbre):
79
  Quefrency = qfrency
@@ -2090,4 +2071,4 @@ with gr.Blocks(theme=gr.themes.Base(), title='Mangio-RVC-Web 💻') as app:
2090
  )
2091
 
2092
  app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=True)
2093
- #endregion
 
44
  DoFormant, Quefrency, Timbre = False, 1.0, 1.0
45
  CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
46
 
47
+ # Download hubert base model
48
+ response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt')
49
 
50
+ if response.status_code == 200:
51
+ with open('./hubert_base.pt', 'wb') as f:
52
+ f.write(response.content)
53
+ print("Downloaded hubert base model file successfully. File saved to ./hubert_base.pt.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  else:
55
+ raise Exception("Failed to download hubert base model file. Status code: " + str(response.status_code) + ".")
56
+
57
+ print("\n-------------------------------\nRVC v2 Easy GUI (Local Edition)\n-------------------------------\n")
58
 
59
  def formant_apply(qfrency, tmbre):
60
  Quefrency = qfrency
 
2071
  )
2072
 
2073
  app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=True)
2074
+ #endregion