kezhui commited on
Commit
c8abdb0
·
verified ·
1 Parent(s): f942fc1

Run inference on CPU with ZeroGPU probe

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -129,7 +129,11 @@ def health(api_key: str = "") -> str:
129
  )
130
 
131
 
132
- @spaces.GPU(duration=300)
 
 
 
 
133
  def transcribe_b64(
134
  api_key: str,
135
  audio_base64: str,
@@ -173,7 +177,6 @@ def transcribe_b64(
173
  )
174
 
175
 
176
- @spaces.GPU(duration=300)
177
  def speech_b64(api_key: str, text: str, voice: str = "zf_xiaoxiao", speed: float = 1.0) -> str:
178
  check_key(api_key)
179
  speed = float(speed)
@@ -212,6 +215,12 @@ with gr.Blocks(title="Voice API") as demo:
212
  with gr.Tab("Health"):
213
  health_out = gr.Textbox(label="result")
214
  gr.Button("Check").click(health, inputs=[api_key], outputs=[health_out], api_name="health")
 
 
 
 
 
 
215
  with gr.Tab("ASR"):
216
  audio_b64 = gr.Textbox(label="audio_base64", lines=5)
217
  filename = gr.Textbox(label="filename", value="audio.wav")
 
129
  )
130
 
131
 
132
+ @spaces.GPU(duration=10)
133
+ def zerogpu_probe() -> str:
134
+ return "ok"
135
+
136
+
137
  def transcribe_b64(
138
  api_key: str,
139
  audio_base64: str,
 
177
  )
178
 
179
 
 
180
  def speech_b64(api_key: str, text: str, voice: str = "zf_xiaoxiao", speed: float = 1.0) -> str:
181
  check_key(api_key)
182
  speed = float(speed)
 
215
  with gr.Tab("Health"):
216
  health_out = gr.Textbox(label="result")
217
  gr.Button("Check").click(health, inputs=[api_key], outputs=[health_out], api_name="health")
218
+ gr.Button("ZeroGPU probe", visible=False).click(
219
+ zerogpu_probe,
220
+ inputs=[],
221
+ outputs=[health_out],
222
+ api_name="zerogpu_probe",
223
+ )
224
  with gr.Tab("ASR"):
225
  audio_b64 = gr.Textbox(label="audio_base64", lines=5)
226
  filename = gr.Textbox(label="filename", value="audio.wav")