Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -209,6 +209,12 @@ def get_musical_prompt(user_prompt, chosen_model):
|
|
209 |
return cleaned_text.lstrip("\n")
|
210 |
|
211 |
def infer(image_in, chosen_model):
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
gr.Info("Getting image caption with Kosmos2...")
|
213 |
user_prompt = get_caption(image_in)
|
214 |
|
@@ -264,7 +270,8 @@ with gr.Blocks(css=css) as demo:
|
|
264 |
"Riffusion",
|
265 |
"Mustango"
|
266 |
],
|
267 |
-
value =
|
|
|
268 |
)
|
269 |
check_status = gr.Textbox(label="API status")
|
270 |
submit_btn = gr.Button("Make music from my pic !")
|
@@ -279,12 +286,12 @@ with gr.Blocks(css=css) as demo:
|
|
279 |
with gr.Column():
|
280 |
gr.Examples(
|
281 |
examples = [
|
282 |
-
["examples/monalisa.png"
|
283 |
-
["examples/santa.png"
|
284 |
-
["examples/ocean_poet.jpeg"
|
285 |
-
["examples/winter_hiking.png"
|
286 |
-
["examples/teatime.jpeg"
|
287 |
-
["examples/news_experts.jpeg"
|
288 |
],
|
289 |
fn = infer,
|
290 |
inputs = [image_in, chosen_model],
|
|
|
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 |
+
if chosen_model == None :
|
216 |
+
raise gr.Error("Please pick a model")
|
217 |
+
|
218 |
gr.Info("Getting image caption with Kosmos2...")
|
219 |
user_prompt = get_caption(image_in)
|
220 |
|
|
|
270 |
"Riffusion",
|
271 |
"Mustango"
|
272 |
],
|
273 |
+
value = None,
|
274 |
+
filterable = False
|
275 |
)
|
276 |
check_status = gr.Textbox(label="API status")
|
277 |
submit_btn = gr.Button("Make music from my pic !")
|
|
|
286 |
with gr.Column():
|
287 |
gr.Examples(
|
288 |
examples = [
|
289 |
+
["examples/monalisa.png"],
|
290 |
+
["examples/santa.png"],
|
291 |
+
["examples/ocean_poet.jpeg"],
|
292 |
+
["examples/winter_hiking.png"],
|
293 |
+
["examples/teatime.jpeg"],
|
294 |
+
["examples/news_experts.jpeg"]
|
295 |
],
|
296 |
fn = infer,
|
297 |
inputs = [image_in, chosen_model],
|