Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix lojban sample path
Browse files- app.py +3 -1
- gr_client.py +9 -3
app.py
CHANGED
|
@@ -16,9 +16,11 @@ commits = model_repo.list_repo_commits(repo_id=hf_model_name)
|
|
| 16 |
latest_commit_sha = commits[0].commit_id
|
| 17 |
hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
|
| 18 |
|
|
|
|
| 19 |
commits = model_repo.list_repo_commits(repo_id='Pendrokar/xvasynth_lojban')
|
| 20 |
latest_commit_sha = commits[0].commit_id
|
| 21 |
hf_cache_lojban_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvasynth_lojban/snapshots/{latest_commit_sha}/'
|
|
|
|
| 22 |
models_path = hf_cache_models_path
|
| 23 |
|
| 24 |
current_voice_model = None
|
|
@@ -169,5 +171,5 @@ class LocalBlocksDemo(BlocksDemo):
|
|
| 169 |
|
| 170 |
if __name__ == "__main__":
|
| 171 |
print('running custom Gradio interface')
|
| 172 |
-
demo = LocalBlocksDemo(models_path)
|
| 173 |
demo.block.launch()
|
|
|
|
| 16 |
latest_commit_sha = commits[0].commit_id
|
| 17 |
hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
|
| 18 |
|
| 19 |
+
print(hf_cache_models_path)
|
| 20 |
commits = model_repo.list_repo_commits(repo_id='Pendrokar/xvasynth_lojban')
|
| 21 |
latest_commit_sha = commits[0].commit_id
|
| 22 |
hf_cache_lojban_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvasynth_lojban/snapshots/{latest_commit_sha}/'
|
| 23 |
+
print(hf_cache_lojban_models_path)
|
| 24 |
models_path = hf_cache_models_path
|
| 25 |
|
| 26 |
current_voice_model = None
|
|
|
|
| 171 |
|
| 172 |
if __name__ == "__main__":
|
| 173 |
print('running custom Gradio interface')
|
| 174 |
+
demo = LocalBlocksDemo(models_path, lojban_models_path)
|
| 175 |
demo.block.launch()
|
gr_client.py
CHANGED
|
@@ -316,8 +316,9 @@ _DESCRIPTION = '''
|
|
| 316 |
|
| 317 |
|
| 318 |
class BlocksDemo:
|
| 319 |
-
def __init__(self, models_path):
|
| 320 |
self.models_path = models_path
|
|
|
|
| 321 |
self.block = self.create_interface()
|
| 322 |
|
| 323 |
def create_interface(self):
|
|
@@ -584,17 +585,22 @@ class BlocksDemo:
|
|
| 584 |
if voice_id == 'more':
|
| 585 |
return None
|
| 586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
if __name__ == "__main__":
|
| 588 |
return client.predict(
|
| 589 |
voice_id,
|
| 590 |
api_name="/set_default_audio"
|
| 591 |
)
|
| 592 |
|
| 593 |
-
return
|
| 594 |
|
| 595 |
if __name__ == "__main__":
|
| 596 |
print('running Gradio interface')
|
| 597 |
client = Client("Pendrokar/xVASynth")
|
| 598 |
|
| 599 |
-
demo = BlocksDemo('')
|
| 600 |
demo.block.launch()
|
|
|
|
| 316 |
|
| 317 |
|
| 318 |
class BlocksDemo:
|
| 319 |
+
def __init__(self, models_path, lojban_models_path):
|
| 320 |
self.models_path = models_path
|
| 321 |
+
self.lojban_models_path = lojban_models_path
|
| 322 |
self.block = self.create_interface()
|
| 323 |
|
| 324 |
def create_interface(self):
|
|
|
|
| 585 |
if voice_id == 'more':
|
| 586 |
return None
|
| 587 |
|
| 588 |
+
if voice_id == 'x_selpahi':
|
| 589 |
+
sample_path = self.lojban_models_path
|
| 590 |
+
else:
|
| 591 |
+
sample_path = self.models_path
|
| 592 |
+
|
| 593 |
if __name__ == "__main__":
|
| 594 |
return client.predict(
|
| 595 |
voice_id,
|
| 596 |
api_name="/set_default_audio"
|
| 597 |
)
|
| 598 |
|
| 599 |
+
return sample_path + voice_id + '.wav'
|
| 600 |
|
| 601 |
if __name__ == "__main__":
|
| 602 |
print('running Gradio interface')
|
| 603 |
client = Client("Pendrokar/xVASynth")
|
| 604 |
|
| 605 |
+
demo = BlocksDemo('', '')
|
| 606 |
demo.block.launch()
|