Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,8 +8,8 @@ from huggingface_hub import hf_hub_download
|
|
| 8 |
# from modules.v2.vc_wrapper import VoiceConversionWrapper
|
| 9 |
|
| 10 |
# --- CONFIGURATION (UPDATE YOUR_USERNAME HERE) ---
|
| 11 |
-
#
|
| 12 |
-
MODEL_REPO_ID = "Bajiyo/dhanush_seedvc"
|
| 13 |
CFM_FILE = "CFM_epoch_00651_step_21500.pth"
|
| 14 |
AR_FILE = "AR_epoch_00651_step_21500.pth"
|
| 15 |
# -----------------------------------------------
|
|
@@ -84,18 +84,14 @@ def main(args):
|
|
| 84 |
# load_models handles the download and initialization now
|
| 85 |
vc_wrapper = load_models(args)
|
| 86 |
|
| 87 |
-
# Define wrapper function for Gradio
|
| 88 |
-
@gr.gradio()
|
| 89 |
-
@spaces.GPU # Ensures conversion runs on the specified GPU if available
|
| 90 |
def convert_voice_wrapper(source_audio_path, target_audio_path, diffusion_steps,
|
| 91 |
length_adjust, intelligibility_cfg_rate, similarity_cfg_rate,
|
| 92 |
top_p, temperature, repetition_penalty, convert_style,
|
| 93 |
anonymization_only, stream_output=True):
|
| 94 |
"""
|
| 95 |
-
Wrapper function for vc_wrapper.convert_voice_with_streaming
|
| 96 |
"""
|
| 97 |
-
# Ensure correct type for the stream_output argument if needed,
|
| 98 |
-
# though the main function is now calling convert_voice_with_streaming directly
|
| 99 |
yield from vc_wrapper.convert_voice_with_streaming(
|
| 100 |
source_audio_path=source_audio_path,
|
| 101 |
target_audio_path=target_audio_path,
|
|
@@ -160,14 +156,13 @@ def main(args):
|
|
| 160 |
title="Seed Voice Conversion V2",
|
| 161 |
examples=examples,
|
| 162 |
cache_examples=False,
|
| 163 |
-
).queue().launch(share=False)
|
| 164 |
|
| 165 |
if __name__ == "__main__":
|
| 166 |
import argparse
|
| 167 |
parser = argparse.ArgumentParser()
|
| 168 |
parser.add_argument("--compile", action="store_true", help="Compile the model using torch.compile")
|
| 169 |
# These arguments are now effectively ignored/not needed since we download the models
|
| 170 |
-
# but we keep them to maintain compatibility with the original script structure.
|
| 171 |
parser.add_argument("--ar-checkpoint-path", type=str, default=None,
|
| 172 |
help="Path to custom checkpoint file (overridden by HF download in Space)")
|
| 173 |
parser.add_argument("--cfm-checkpoint-path", type=str, default=None,
|
|
|
|
| 8 |
# from modules.v2.vc_wrapper import VoiceConversionWrapper
|
| 9 |
|
| 10 |
# --- CONFIGURATION (UPDATE YOUR_USERNAME HERE) ---
|
| 11 |
+
# Your correct model repository ID
|
| 12 |
+
MODEL_REPO_ID = "Bajiyo/dhanush_seedvc"
|
| 13 |
CFM_FILE = "CFM_epoch_00651_step_21500.pth"
|
| 14 |
AR_FILE = "AR_epoch_00651_step_21500.pth"
|
| 15 |
# -----------------------------------------------
|
|
|
|
| 84 |
# load_models handles the download and initialization now
|
| 85 |
vc_wrapper = load_models(args)
|
| 86 |
|
| 87 |
+
# Define wrapper function for Gradio. NO DECORATORS HERE.
|
|
|
|
|
|
|
| 88 |
def convert_voice_wrapper(source_audio_path, target_audio_path, diffusion_steps,
|
| 89 |
length_adjust, intelligibility_cfg_rate, similarity_cfg_rate,
|
| 90 |
top_p, temperature, repetition_penalty, convert_style,
|
| 91 |
anonymization_only, stream_output=True):
|
| 92 |
"""
|
| 93 |
+
Wrapper function for vc_wrapper.convert_voice_with_streaming.
|
| 94 |
"""
|
|
|
|
|
|
|
| 95 |
yield from vc_wrapper.convert_voice_with_streaming(
|
| 96 |
source_audio_path=source_audio_path,
|
| 97 |
target_audio_path=target_audio_path,
|
|
|
|
| 156 |
title="Seed Voice Conversion V2",
|
| 157 |
examples=examples,
|
| 158 |
cache_examples=False,
|
| 159 |
+
).queue().launch(share=False)
|
| 160 |
|
| 161 |
if __name__ == "__main__":
|
| 162 |
import argparse
|
| 163 |
parser = argparse.ArgumentParser()
|
| 164 |
parser.add_argument("--compile", action="store_true", help="Compile the model using torch.compile")
|
| 165 |
# These arguments are now effectively ignored/not needed since we download the models
|
|
|
|
| 166 |
parser.add_argument("--ar-checkpoint-path", type=str, default=None,
|
| 167 |
help="Path to custom checkpoint file (overridden by HF download in Space)")
|
| 168 |
parser.add_argument("--cfm-checkpoint-path", type=str, default=None,
|