fffiloni commited on
Commit
adb2981
1 Parent(s): 3114537

added Tango model

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -117,6 +117,17 @@ def get_audiogen(prompt):
117
  )
118
  return result
119
 
 
 
 
 
 
 
 
 
 
 
 
120
  def infer(image_in, chosen_model):
121
  caption = get_caption(image_in)
122
  if chosen_model == "MAGNet" :
@@ -128,6 +139,9 @@ def infer(image_in, chosen_model):
128
  elif chosen_model == "AudioGen" :
129
  audiogen_result = get_audiogen(caption)
130
  return audiogen_result
 
 
 
131
 
132
  css="""
133
  #col-container{
@@ -150,7 +164,7 @@ with gr.Blocks(css=css) as demo:
150
  with gr.Column():
151
  image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
152
  with gr.Row():
153
- chosen_model = gr.Radio(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen"], value="AudioLDM-2")
154
  submit_btn = gr.Button("Submit")
155
  with gr.Column():
156
  audio_o = gr.Audio(label="Audio output")
 
117
  )
118
  return result
119
 
120
+ def get_tango(prompt):
121
+ client = Client("https://declare-lab-tango.hf.space/")
122
+ result = client.predict(
123
+ "Howdy!", # str representing string value in 'Prompt' Textbox component
124
+ 100, # int | float representing numeric value between 100 and 200 in 'Steps' Slider component
125
+ 4, # int | float representing numeric value between 1 and 10 in 'Guidance Scale' Slider component
126
+ api_name="/predict"
127
+ )
128
+ print(result)
129
+ return result
130
+
131
  def infer(image_in, chosen_model):
132
  caption = get_caption(image_in)
133
  if chosen_model == "MAGNet" :
 
139
  elif chosen_model == "AudioGen" :
140
  audiogen_result = get_audiogen(caption)
141
  return audiogen_result
142
+ elif chosen_model == "Tango" :
143
+ tango_result = get_tango(caption)
144
+ return tango_result
145
 
146
  css="""
147
  #col-container{
 
164
  with gr.Column():
165
  image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
166
  with gr.Row():
167
+ chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango"], value="AudioLDM-2")
168
  submit_btn = gr.Button("Submit")
169
  with gr.Column():
170
  audio_o = gr.Audio(label="Audio output")