Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import os
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
import gradio as gr
|
@@ -11,10 +10,6 @@ from matplotlib.font_manager import FontProperties
|
|
11 |
|
12 |
from model.tinyvad import TinyVAD
|
13 |
|
14 |
-
# Configuration
|
15 |
-
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
16 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
17 |
-
|
18 |
# Font configuration
|
19 |
font_path = './fonts/Times_New_Roman.ttf'
|
20 |
font_prop = FontProperties(fname=font_path, size=18)
|
@@ -27,7 +22,7 @@ TARGET_SAMPLE_RATE = 16000
|
|
27 |
|
28 |
# Model Initialization
|
29 |
model = TinyVAD(1, 32, 64, patch_size=8, num_blocks=2,
|
30 |
-
sinc_conv=SINC_CONV, ssm=SSM)
|
31 |
checkpoint_path = './sincvad.ckpt'
|
32 |
model.load_state_dict(torch.load(checkpoint_path, weights_only=True))
|
33 |
model.eval()
|
@@ -196,7 +191,6 @@ with gr.Blocks() as demo:
|
|
196 |
api_name="predict"
|
197 |
)
|
198 |
|
199 |
-
|
200 |
# Launch Configuration
|
201 |
if __name__ == "__main__":
|
202 |
demo.queue() # Enable queue to support generators
|
|
|
|
|
1 |
import torch
|
2 |
import torch.nn as nn
|
3 |
import gradio as gr
|
|
|
10 |
|
11 |
from model.tinyvad import TinyVAD
|
12 |
|
|
|
|
|
|
|
|
|
13 |
# Font configuration
|
14 |
font_path = './fonts/Times_New_Roman.ttf'
|
15 |
font_prop = FontProperties(fname=font_path, size=18)
|
|
|
22 |
|
23 |
# Model Initialization
|
24 |
model = TinyVAD(1, 32, 64, patch_size=8, num_blocks=2,
|
25 |
+
sinc_conv=SINC_CONV, ssm=SSM)
|
26 |
checkpoint_path = './sincvad.ckpt'
|
27 |
model.load_state_dict(torch.load(checkpoint_path, weights_only=True))
|
28 |
model.eval()
|
|
|
191 |
api_name="predict"
|
192 |
)
|
193 |
|
|
|
194 |
# Launch Configuration
|
195 |
if __name__ == "__main__":
|
196 |
demo.queue() # Enable queue to support generators
|