Spaces:
Sleeping
Sleeping
Chin-Yun Yu commited on
Commit ·
4656421
1
Parent(s): e5a869e
feat: integrate zeroGPU decorator for inference and render functions
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
from scipy.io.wavfile import read
|
|
@@ -237,6 +238,7 @@ def convert2float(sr: int, x: np.ndarray) -> np.ndarray:
|
|
| 237 |
return x
|
| 238 |
|
| 239 |
|
|
|
|
| 240 |
def inference(
|
| 241 |
input_audio,
|
| 242 |
ref_audio,
|
|
@@ -318,6 +320,7 @@ def inference(
|
|
| 318 |
return vec
|
| 319 |
|
| 320 |
|
|
|
|
| 321 |
def render(y, remove_approx, ratio, vec):
|
| 322 |
device = environ.get("DEVICE", "cpu")
|
| 323 |
y = convert2float(*y)
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
| 4 |
from scipy.io.wavfile import read
|
|
|
|
| 238 |
return x
|
| 239 |
|
| 240 |
|
| 241 |
+
@spaces.GPU(duration=60)
|
| 242 |
def inference(
|
| 243 |
input_audio,
|
| 244 |
ref_audio,
|
|
|
|
| 320 |
return vec
|
| 321 |
|
| 322 |
|
| 323 |
+
@spaces.GPU(duration=10)
|
| 324 |
def render(y, remove_approx, ratio, vec):
|
| 325 |
device = environ.get("DEVICE", "cpu")
|
| 326 |
y = convert2float(*y)
|