kevinwang676 commited on
Commit
5c47cba
1 Parent(s): 639925f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -11,6 +11,8 @@ from utils.hparams import hparams as hp
11
  import numpy as np
12
  from inference.m4singer.gradio.share_btn import community_icon_html, loading_icon_html, share_js
13
 
 
 
14
  class GradioInfer:
15
  def __init__(self, exp_name, inference_cls, title, description, article, example_inputs):
16
  self.exp_name = exp_name
@@ -22,6 +24,7 @@ class GradioInfer:
22
  cls_name = inference_cls.split(".")[-1]
23
  self.inference_cls = getattr(importlib.import_module(pkg), cls_name)
24
 
 
25
  def greet(self, singer, text, notes, notes_duration):
26
  PUNCS = '。?;:'
27
  sents = re.split(rf'([{PUNCS}])', text.replace('\n', ','))
@@ -132,7 +135,7 @@ class GradioInfer:
132
  generate.click(self.greet,
133
  inputs=[singer_l, inp_text, inp_note, inp_duration],
134
  outputs=[singing_output, share_button, community_icon, loading_icon],)
135
- demo.queue().launch(share=True)
136
 
137
 
138
  if __name__ == '__main__':
 
11
  import numpy as np
12
  from inference.m4singer.gradio.share_btn import community_icon_html, loading_icon_html, share_js
13
 
14
+ import spaces
15
+
16
  class GradioInfer:
17
  def __init__(self, exp_name, inference_cls, title, description, article, example_inputs):
18
  self.exp_name = exp_name
 
24
  cls_name = inference_cls.split(".")[-1]
25
  self.inference_cls = getattr(importlib.import_module(pkg), cls_name)
26
 
27
+ @spaces.GPU(duration=180)
28
  def greet(self, singer, text, notes, notes_duration):
29
  PUNCS = '。?;:'
30
  sents = re.split(rf'([{PUNCS}])', text.replace('\n', ','))
 
135
  generate.click(self.greet,
136
  inputs=[singer_l, inp_text, inp_note, inp_duration],
137
  outputs=[singing_output, share_button, community_icon, loading_icon],)
138
+ demo.queue().launch(show_error=True)
139
 
140
 
141
  if __name__ == '__main__':