fffiloni commited on
Commit
26ae92c
1 Parent(s): 6122bcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -150,10 +150,22 @@ Immediately STOP after that. It should be EXACTLY in this format:
150
  "A grand orchestral arrangement with thunderous percussion, epic brass fanfares, and soaring strings, creating a cinematic atmosphere fit for a heroic battle"
151
  """
152
 
 
 
 
 
 
 
 
 
 
153
  @spaces.GPU(enable_queue=True)
154
- def get_musical_prompt(user_prompt):
155
-
156
- agent_maker_sys = standard_sys
 
 
 
157
 
158
  instruction = f"""
159
  <|system|>
@@ -174,7 +186,7 @@ def infer(image_in, chosen_model):
174
  user_prompt = get_caption(image_in)
175
 
176
  gr.Info("Building a musical prompt according to the image caption ...")
177
- musical_prompt = get_musical_prompt(user_prompt)
178
 
179
  if chosen_model == "MAGNet" :
180
  gr.Info("Now calling MAGNet for music...")
 
150
  "A grand orchestral arrangement with thunderous percussion, epic brass fanfares, and soaring strings, creating a cinematic atmosphere fit for a heroic battle"
151
  """
152
 
153
+ mustango_sys = f"""
154
+ You are an AI whose job is to help users create their own music which its genre will reflect the character or scene from an image described by users.
155
+ In particular, you need to respond succintly with few musical words, in a friendly tone, write a musical prompt for a music generation model, incmudond chords progression.
156
+
157
+ For example, if a user says, "a painting of three old women having tea party", provide immediately a musical prompt corresponding to the image description.
158
+ Immediately STOP after that. It should be EXACTLY in this format:
159
+ "The song is an instrumental. The song is in medium tempo with a classical guitar playing a lilting melody in accompaniment style. The song is emotional and romantic. The song is a romantic instrumental song. The chord sequence is Gm, F6, Ebm. The time signature is 4/4. This song is in Adagio. The key of this song is G minor."
160
+ """
161
+
162
  @spaces.GPU(enable_queue=True)
163
+ def get_musical_prompt(user_prompt, chosen_model):
164
+
165
+ if chosen_model == "Mustango" :
166
+ agent_maker_sys = mustango_sys
167
+ else :
168
+ agent_maker_sys = standard_sys
169
 
170
  instruction = f"""
171
  <|system|>
 
186
  user_prompt = get_caption(image_in)
187
 
188
  gr.Info("Building a musical prompt according to the image caption ...")
189
+ musical_prompt = get_musical_prompt(user_prompt, chosen_model)
190
 
191
  if chosen_model == "MAGNet" :
192
  gr.Info("Now calling MAGNet for music...")