File size: 1,510 Bytes
dbcea98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9836b3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
title = "DIFF-SVC"
description = """
<p>
<body style="background-color: #18181a; color: white;"></body>
<center>
    <h1>DIFF-SVC Inference Cloud</h1>
    This is a Cloud Inference where you can render your models with your wav files
    <p>Enter a link:</p>
    <input type="text" id="link-input"/>
    <p>Upload a WAV file:</p> <input type="file" id="wav-input" accept=".wav"/>
    <button id="render-button">Render</button>
    <p>Diff-SVC prediction:</p>
    <p id="prediction-output"></p>
</center>
</p>
"""
from utils.hparams import hparams
from preprocessing.data_gen_utils import get_pitch_parselmouth,get_pitch_crepe
import numpy as np
import matplotlib.pyplot as plt
import IPython.display as ipd
import utils
import librosa
import torchcrepe
from infer import *
import logging
from infer_tools.infer_tool import *
##EDIT FOR CPU
# Open the file and read it into a string
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
    text = f.read()
# Replace the original line with the new line
text = text.replace("def load(f, map_location=None, pickle_module=pickle, **pickle_load_args):", "def load(f, map_location='cpu', pickle_module=pickle, **pickle_load_args):")
# Save the modified string to the original file
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", "w") as f:
    f.write(text)
print("Replaced")
#with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
#    text = f.read()
#print(text)