Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -189,11 +189,14 @@ Immediately STOP after that. It should be EXACTLY in this format:
|
|
| 189 |
@spaces.GPU(enable_queue=True)
|
| 190 |
def get_musical_prompt(user_prompt, chosen_model):
|
| 191 |
|
|
|
|
| 192 |
if chosen_model == "Mustango" :
|
| 193 |
agent_maker_sys = standard_sys
|
| 194 |
else :
|
| 195 |
agent_maker_sys = standard_sys
|
| 196 |
-
|
|
|
|
|
|
|
| 197 |
instruction = f"""
|
| 198 |
<|system|>
|
| 199 |
{agent_maker_sys}</s>
|
|
@@ -269,20 +272,25 @@ css = """
|
|
| 269 |
"""
|
| 270 |
|
| 271 |
with gr.Blocks(css=css) as demo:
|
|
|
|
| 272 |
with gr.Column(elem_id="col-container"):
|
|
|
|
| 273 |
gr.HTML(f"""
|
| 274 |
<h2 style="text-align: center;">{demo_title}</h2>
|
| 275 |
<p style="text-align: center;">{description}</p>
|
| 276 |
""")
|
| 277 |
|
| 278 |
with gr.Row():
|
|
|
|
| 279 |
with gr.Column():
|
| 280 |
image_in = gr.Image(
|
| 281 |
label = "Image reference",
|
| 282 |
type = "filepath",
|
| 283 |
elem_id = "image-in"
|
| 284 |
)
|
|
|
|
| 285 |
with gr.Row():
|
|
|
|
| 286 |
chosen_model = gr.Dropdown(
|
| 287 |
label = "Choose a model",
|
| 288 |
choices = [
|
|
@@ -294,19 +302,30 @@ with gr.Blocks(css=css) as demo:
|
|
| 294 |
value = None,
|
| 295 |
filterable = False
|
| 296 |
)
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
submit_btn = gr.Button("Make music from my pic !")
|
|
|
|
| 299 |
with gr.Column():
|
|
|
|
| 300 |
caption = gr.Textbox(
|
| 301 |
label = "Inspirational musical prompt",
|
| 302 |
max_lines = 6,
|
| 303 |
interactive = False
|
| 304 |
)
|
|
|
|
| 305 |
retry_btn = gr.Button("Retry with edited prompt", visible=False)
|
|
|
|
| 306 |
result = gr.Audio(
|
| 307 |
label = "Music"
|
| 308 |
)
|
|
|
|
| 309 |
with gr.Column():
|
|
|
|
| 310 |
gr.Examples(
|
| 311 |
examples = [
|
| 312 |
["examples/monalisa.png"],
|
|
|
|
| 189 |
@spaces.GPU(enable_queue=True)
|
| 190 |
def get_musical_prompt(user_prompt, chosen_model):
|
| 191 |
|
| 192 |
+
"""
|
| 193 |
if chosen_model == "Mustango" :
|
| 194 |
agent_maker_sys = standard_sys
|
| 195 |
else :
|
| 196 |
agent_maker_sys = standard_sys
|
| 197 |
+
"""
|
| 198 |
+
agent_maker_sys = standard_sys
|
| 199 |
+
|
| 200 |
instruction = f"""
|
| 201 |
<|system|>
|
| 202 |
{agent_maker_sys}</s>
|
|
|
|
| 272 |
"""
|
| 273 |
|
| 274 |
with gr.Blocks(css=css) as demo:
|
| 275 |
+
|
| 276 |
with gr.Column(elem_id="col-container"):
|
| 277 |
+
|
| 278 |
gr.HTML(f"""
|
| 279 |
<h2 style="text-align: center;">{demo_title}</h2>
|
| 280 |
<p style="text-align: center;">{description}</p>
|
| 281 |
""")
|
| 282 |
|
| 283 |
with gr.Row():
|
| 284 |
+
|
| 285 |
with gr.Column():
|
| 286 |
image_in = gr.Image(
|
| 287 |
label = "Image reference",
|
| 288 |
type = "filepath",
|
| 289 |
elem_id = "image-in"
|
| 290 |
)
|
| 291 |
+
|
| 292 |
with gr.Row():
|
| 293 |
+
|
| 294 |
chosen_model = gr.Dropdown(
|
| 295 |
label = "Choose a model",
|
| 296 |
choices = [
|
|
|
|
| 302 |
value = None,
|
| 303 |
filterable = False
|
| 304 |
)
|
| 305 |
+
|
| 306 |
+
check_status = gr.Textbox(
|
| 307 |
+
label="API status",
|
| 308 |
+
interactive=False
|
| 309 |
+
)
|
| 310 |
+
|
| 311 |
submit_btn = gr.Button("Make music from my pic !")
|
| 312 |
+
|
| 313 |
with gr.Column():
|
| 314 |
+
|
| 315 |
caption = gr.Textbox(
|
| 316 |
label = "Inspirational musical prompt",
|
| 317 |
max_lines = 6,
|
| 318 |
interactive = False
|
| 319 |
)
|
| 320 |
+
|
| 321 |
retry_btn = gr.Button("Retry with edited prompt", visible=False)
|
| 322 |
+
|
| 323 |
result = gr.Audio(
|
| 324 |
label = "Music"
|
| 325 |
)
|
| 326 |
+
|
| 327 |
with gr.Column():
|
| 328 |
+
|
| 329 |
gr.Examples(
|
| 330 |
examples = [
|
| 331 |
["examples/monalisa.png"],
|