fffiloni commited on
Commit
906ee65
1 Parent(s): ff0b641

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -208,13 +208,15 @@ def get_musical_prompt(user_prompt, chosen_model):
208
  print(f"SUGGESTED Musical prompt: {cleaned_text}")
209
  return cleaned_text.lstrip("\n")
210
 
211
- def infer(image_in, chosen_model):
212
  if image_in == None :
213
  raise gr.Error("Please provide an image input")
214
 
215
- print(f"CHOSEN MODEL: {chosen_model}")
216
  if chosen_model == [] :
217
  raise gr.Error("Please pick a model")
 
 
 
218
 
219
  gr.Info("Getting image caption with Kosmos2...")
220
  user_prompt = get_caption(image_in)
@@ -337,7 +339,8 @@ with gr.Blocks(css=css) as demo:
337
  fn = infer,
338
  inputs = [
339
  image_in,
340
- chosen_model
 
341
  ],
342
  outputs =[
343
  caption,
 
208
  print(f"SUGGESTED Musical prompt: {cleaned_text}")
209
  return cleaned_text.lstrip("\n")
210
 
211
+ def infer(image_in, chosen_model, api_status):
212
  if image_in == None :
213
  raise gr.Error("Please provide an image input")
214
 
 
215
  if chosen_model == [] :
216
  raise gr.Error("Please pick a model")
217
+
218
+ if api_status == "api not ready yet" :
219
+ raise gr.Error("This model is not ready yet, you can pick another one instead :)")
220
 
221
  gr.Info("Getting image caption with Kosmos2...")
222
  user_prompt = get_caption(image_in)
 
339
  fn = infer,
340
  inputs = [
341
  image_in,
342
+ chosen_model,
343
+ check_status
344
  ],
345
  outputs =[
346
  caption,