fffiloni commited on
Commit
b16b354
1 Parent(s): ac75eb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -10
app.py CHANGED
@@ -3,6 +3,15 @@ import spaces
3
  import json
4
  import re
5
  from gradio_client import Client
 
 
 
 
 
 
 
 
 
6
  from moviepy.editor import VideoFileClip
7
  from moviepy.audio.AudioClip import AudioClip
8
 
@@ -228,16 +237,18 @@ with gr.Blocks(css=css) as demo:
228
  type = "filepath",
229
  elem_id = "image-in"
230
  )
231
- chosen_model = gr.Dropdown(
232
- label = "Choose a model",
233
- choices = [
234
- "MAGNet",
235
- "AudioLDM-2",
236
- "Riffusion",
237
- "Mustango"
238
- ],
239
- value = "MAGNet"
240
- )
 
 
241
  submit_btn = gr.Button("Make music from my pic !")
242
  with gr.Column():
243
  caption = gr.Textbox(
@@ -263,6 +274,13 @@ with gr.Blocks(css=css) as demo:
263
  cache_examples = False
264
  )
265
 
 
 
 
 
 
 
 
266
  submit_btn.click(
267
  fn = infer,
268
  inputs = [
 
3
  import json
4
  import re
5
  from gradio_client import Client
6
+
7
+ def check_api(model_name):
8
+ if model_name == "MAGNet":
9
+ try :
10
+ client = Client("https://fffiloni-magnet.hf.space/")
11
+ return "api ready"
12
+ except :
13
+ return "api not ready yet"
14
+
15
  from moviepy.editor import VideoFileClip
16
  from moviepy.audio.AudioClip import AudioClip
17
 
 
237
  type = "filepath",
238
  elem_id = "image-in"
239
  )
240
+ with gr.Row():
241
+ chosen_model = gr.Dropdown(
242
+ label = "Choose a model",
243
+ choices = [
244
+ "MAGNet",
245
+ "AudioLDM-2",
246
+ "Riffusion",
247
+ "Mustango"
248
+ ],
249
+ value = "MAGNet"
250
+ )
251
+ check_status = gr.Textbox()
252
  submit_btn = gr.Button("Make music from my pic !")
253
  with gr.Column():
254
  caption = gr.Textbox(
 
274
  cache_examples = False
275
  )
276
 
277
+ chosen_model.change(
278
+ fn = check_api,
279
+ inputs = chosen_model,
280
+ outputs = check_status,
281
+ queue = False
282
+ )
283
+
284
  submit_btn.click(
285
  fn = infer,
286
  inputs = [