nateraw commited on
Commit
7fc71d5
1 Parent(s): 606a5bf

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -30,6 +30,8 @@ default_f0_method = "crepe"
30
  # The default ratio of cluster inference to SVC inference.
31
  # If cluster_model_name is not found in the repo, this is set to 0.
32
  default_cluster_infer_ratio = 0.5
 
 
33
  ###################################################################
34
 
35
  # Figure out the latest generator by taking highest value one.
@@ -135,7 +137,7 @@ def predict(
135
  chunk_seconds: float = 0.5,
136
  absolute_thresh: bool = False,
137
  ):
138
- audio, _ = librosa.load(audio, sr=model.target_sample)
139
  audio = model.infer_silence(
140
  audio.astype(np.float32),
141
  speaker=speaker,
@@ -167,6 +169,7 @@ def predict_song_from_yt(
167
  chunk_seconds: float = 0.5,
168
  absolute_thresh: bool = False,
169
  ):
 
170
  original_track_filepath = download_youtube_clip(
171
  ytid_or_url,
172
  start,
@@ -201,9 +204,7 @@ description = f"""
201
 
202
  <center><a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></center>
203
 
204
- ## This app uses models trained with [so-vits-svc-fork](https://github.com/voicepaw/so-vits-svc-fork) to clone a voice. Model currently being used is https://hf.co/{repo_id}.
205
-
206
- #### To change the model being served, duplicate the space and update the `repo_id`/other settings in `app.py`.
207
 
208
  #### Train Your Own: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nateraw/voice-cloning/blob/main/training_so_vits_svc_fork.ipynb)
209
  """.strip()
 
30
  # The default ratio of cluster inference to SVC inference.
31
  # If cluster_model_name is not found in the repo, this is set to 0.
32
  default_cluster_infer_ratio = 0.5
33
+ # Limit on duration of audio at inference time. increase if you can
34
+ duration_limit = 30
35
  ###################################################################
36
 
37
  # Figure out the latest generator by taking highest value one.
 
137
  chunk_seconds: float = 0.5,
138
  absolute_thresh: bool = False,
139
  ):
140
+ audio, _ = librosa.load(audio, sr=model.target_sample, duration=duration_limit)
141
  audio = model.infer_silence(
142
  audio.astype(np.float32),
143
  speaker=speaker,
 
169
  chunk_seconds: float = 0.5,
170
  absolute_thresh: bool = False,
171
  ):
172
+ end = min(start + duration_limit, end)
173
  original_track_filepath = download_youtube_clip(
174
  ytid_or_url,
175
  start,
 
204
 
205
  <center><a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></center>
206
 
207
+ #### This app uses models trained with [so-vits-svc-fork](https://github.com/voicepaw/so-vits-svc-fork) to clone a voice. Model currently being used is https://hf.co/{repo_id}. To change the model being served, duplicate the space and update the `repo_id`/other settings in `app.py`.
 
 
208
 
209
  #### Train Your Own: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nateraw/voice-cloning/blob/main/training_so_vits_svc_fork.ipynb)
210
  """.strip()