Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
add Umamusume model
Browse files- README.md +1 -1
- app.py +6 -14
- export_model.py +2 -2
- saved_model/18/config.json +3 -0
- saved_model/18/cover.jpg +3 -0
- saved_model/18/model.pth +3 -0
- saved_model/info.json +2 -2
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: πποΈ
|
|
4 |
colorFrom: red
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
4 |
colorFrom: red
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.16.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
app.py
CHANGED
@@ -3,6 +3,7 @@ import json
|
|
3 |
import os
|
4 |
import re
|
5 |
import tempfile
|
|
|
6 |
|
7 |
import librosa
|
8 |
import numpy as np
|
@@ -19,23 +20,14 @@ from mel_processing import spectrogram_torch
|
|
19 |
|
20 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
21 |
|
|
|
|
|
22 |
|
23 |
def audio_postprocess(self, y):
|
24 |
-
|
|
|
25 |
return None
|
26 |
-
|
27 |
-
if gr_utils.validate_url(y):
|
28 |
-
file = gr_processing_utils.download_to_file(y, dir=self.temp_dir)
|
29 |
-
elif isinstance(y, tuple):
|
30 |
-
sample_rate, data = y
|
31 |
-
file = tempfile.NamedTemporaryFile(
|
32 |
-
suffix=".wav", dir=self.temp_dir, delete=False
|
33 |
-
)
|
34 |
-
gr_processing_utils.audio_to_file(sample_rate, data, file.name)
|
35 |
-
else:
|
36 |
-
file = gr_processing_utils.create_tmp_copy_of_file(y, dir=self.temp_dir)
|
37 |
-
|
38 |
-
return gr_processing_utils.encode_url_or_file_to_base64(file.name)
|
39 |
|
40 |
|
41 |
gr.Audio.postprocess = audio_postprocess
|
|
|
3 |
import os
|
4 |
import re
|
5 |
import tempfile
|
6 |
+
from pathlib import Path
|
7 |
|
8 |
import librosa
|
9 |
import numpy as np
|
|
|
20 |
|
21 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
22 |
|
23 |
+
audio_postprocess_ori = gr.Audio.postprocess
|
24 |
+
|
25 |
|
26 |
def audio_postprocess(self, y):
|
27 |
+
data = audio_postprocess_ori(self, y)
|
28 |
+
if data is None:
|
29 |
return None
|
30 |
+
return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
|
33 |
gr.Audio.postprocess = audio_postprocess
|
export_model.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import torch
|
2 |
|
3 |
if __name__ == '__main__':
|
4 |
-
model_path = "saved_model/
|
5 |
-
output_path = "saved_model/
|
6 |
checkpoint_dict = torch.load(model_path, map_location='cpu')
|
7 |
checkpoint_dict_new = {}
|
8 |
for k, v in checkpoint_dict.items():
|
|
|
1 |
import torch
|
2 |
|
3 |
if __name__ == '__main__':
|
4 |
+
model_path = "saved_model/18/model.pth"
|
5 |
+
output_path = "saved_model/18/model1.pth"
|
6 |
checkpoint_dict = torch.load(model_path, map_location='cpu')
|
7 |
checkpoint_dict_new = {}
|
8 |
for k, v in checkpoint_dict.items():
|
saved_model/18/config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aaa921889da820eee740426dc28f8b11242d5ea64635d75460b04d0f4c830f83
|
3 |
+
size 3336
|
saved_model/18/cover.jpg
ADDED
Git LFS Details
|
saved_model/18/model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a53f4eb6bf8226b3fb4a3b31436235f697692f5566039ce3491b80af9a9567a
|
3 |
+
size 158962765
|
saved_model/info.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b6c673fd78f290cc81ee399069e2bd68125c768658f0a46e320070255cd93bab
|
3 |
+
size 4889
|