Sylvain Filoni commited on
Commit
36960e6
โ€ข
1 Parent(s): 8252714
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,11 +18,11 @@ img_to_text = gr.Blocks.load(name="spaces/pharma/CLIP-Interrogator")
18
  from share_btn import community_icon_html, loading_icon_html, share_js
19
 
20
  def get_prompts(uploaded_image, track_duration, gen_intensity):
21
-
22
  prompt = img_to_text(uploaded_image, "ViT-L (best for Stable Diffusion 1.*)", "fast", fn_index=1)[0]
23
-
24
  music_result = generate_track_by_prompt(prompt, track_duration, gen_intensity)
25
-
26
  return music_result[0], gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
27
 
28
  from utils import get_tags_for_prompts, get_mubert_tags_embeddings, get_pat
@@ -90,7 +90,7 @@ def convert_mp3_to_wav(mp3_filepath):
90
  return wave_file
91
 
92
  css = """
93
- #col-container {max-width: 550px; margin-left: auto; margin-right: auto;}
94
  a {text-decoration-line: underline; font-weight: 600;}
95
  .footer {
96
  margin-bottom: 45px;
@@ -177,7 +177,7 @@ with gr.Blocks(css=css) as demo:
177
  input_img = gr.Image(type="filepath", elem_id="input-img")
178
  with gr.Row():
179
  track_duration = gr.Slider(minimum=20, maximum=120, value=30, step=5, label="Track duration", elem_id="duration-inp")
180
- gen_intensity = gr.Radio(choices=["low", "medium", "high"], value="high", label="Complexity", show_label=False)
181
  generate = gr.Button("Generate Music from Image")
182
 
183
  music_output = gr.Audio(label="Result", type="filepath", elem_id="music-output")
 
18
  from share_btn import community_icon_html, loading_icon_html, share_js
19
 
20
  def get_prompts(uploaded_image, track_duration, gen_intensity):
21
+ print("calling clip interrogator")
22
  prompt = img_to_text(uploaded_image, "ViT-L (best for Stable Diffusion 1.*)", "fast", fn_index=1)[0]
23
+ print(prompt)
24
  music_result = generate_track_by_prompt(prompt, track_duration, gen_intensity)
25
+ print(music_result)
26
  return music_result[0], gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
27
 
28
  from utils import get_tags_for_prompts, get_mubert_tags_embeddings, get_pat
 
90
  return wave_file
91
 
92
  css = """
93
+ #col-container {max-width: 580px; margin-left: auto; margin-right: auto;}
94
  a {text-decoration-line: underline; font-weight: 600;}
95
  .footer {
96
  margin-bottom: 45px;
 
177
  input_img = gr.Image(type="filepath", elem_id="input-img")
178
  with gr.Row():
179
  track_duration = gr.Slider(minimum=20, maximum=120, value=30, step=5, label="Track duration", elem_id="duration-inp")
180
+ gen_intensity = gr.Radio(choices=["low", "medium", "high"], value="high", label="Complexity")
181
  generate = gr.Button("Generate Music from Image")
182
 
183
  music_output = gr.Audio(label="Result", type="filepath", elem_id="music-output")