TulipAIs commited on
Commit
66e2da5
1 Parent(s): 6735550

adding "MusicGen" tab back.

Browse files

the last version was showing, but generation was not working! hopefully by adding this tab back, generation works again

Files changed (1) hide show
  1. app.py +106 -0
app.py CHANGED
@@ -1053,6 +1053,112 @@ def ui_full(launch_kwargs):
1053
  send_audio_a = gr.Button("Send to Input Audio")
1054
  seed_used_a = gr.Number(label='Seed used', value=-1, interactive=False)
1055
  download_a = gr.File(label="Generated Files", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1056
  with gr.Tab("Wiki"):
1057
  gr.Markdown(
1058
  """
 
1053
  send_audio_a = gr.Button("Send to Input Audio")
1054
  seed_used_a = gr.Number(label='Seed used', value=-1, interactive=False)
1055
  download_a = gr.File(label="Generated Files", interactive=False)
1056
+ with gr.Tab("MusicGen"):
1057
+ gr.Markdown(
1058
+ """
1059
+ ### MusicGen
1060
+ Check the "Wiki" to learn how to take the most out of TulipAI Soundscapes Music Generation Tool.
1061
+ """
1062
+ )
1063
+ with gr.Tab("Generate Music"):
1064
+ with gr.Row():
1065
+ with gr.Column():
1066
+ with gr.Tab("Generation"):
1067
+ with gr.Accordion("Structure Prompts", open=False):
1068
+ with gr.Column():
1069
+ with gr.Row():
1070
+ struc_prompts = gr.Checkbox(label="Enable", value=False, interactive=True, container=False)
1071
+ bpm = gr.Number(label="BPM", value=120, interactive=True, scale=1, precision=0)
1072
+ key = gr.Dropdown(["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "Bb", "B"], label="Key", value="C", interactive=True)
1073
+ scale = gr.Dropdown(["Major", "Minor"], label="Scale", value="Major", interactive=True)
1074
+ with gr.Row():
1075
+ global_prompt = gr.Text(label="Global Prompt", interactive=True, scale=3)
1076
+ with gr.Row():
1077
+ s = gr.Slider(1, max_textboxes, value=1, step=1, label="Prompts:", interactive=True, scale=2)
1078
+ #s_mode = gr.Radio(["segmentation", "batch"], value="segmentation", interactive=True, scale=1, label="Generation Mode")
1079
+ with gr.Column():
1080
+ textboxes = []
1081
+ prompts = []
1082
+ repeats = []
1083
+ calcs = []
1084
+ with gr.Row():
1085
+ text0 = gr.Text(label="Input Text", interactive=True, scale=4)
1086
+ prompts.append(text0)
1087
+ drag0 = gr.Number(label="Repeat", value=1, interactive=True, scale=1)
1088
+ repeats.append(drag0)
1089
+ calc0 = gr.Text(interactive=False, value="00:00 - 00:00", scale=1, label="Time")
1090
+ calcs.append(calc0)
1091
+ for i in range(max_textboxes):
1092
+ with gr.Row(visible=False) as t:
1093
+ text = gr.Text(label="Input Text", interactive=True, scale=3)
1094
+ repeat = gr.Number(label="Repeat", minimum=1, value=1, interactive=True, scale=1)
1095
+ calc = gr.Text(interactive=False, value="00:00 - 00:00", scale=1, label="Time")
1096
+ textboxes.append(t)
1097
+ prompts.append(text)
1098
+ repeats.append(repeat)
1099
+ calcs.append(calc)
1100
+ to_calc = gr.Button("Calculate Timings", variant="secondary")
1101
+ with gr.Row():
1102
+ duration = gr.Slider(minimum=1, maximum=300, value=10, step=1, label="Duration", interactive=True)
1103
+ with gr.Row():
1104
+ overlap = gr.Slider(minimum=1, maximum=29, value=12, step=1, label="Overlap", interactive=True)
1105
+ with gr.Row():
1106
+ seed = gr.Number(label="Seed", value=-1, scale=4, precision=0, interactive=True)
1107
+ gr.Button('\U0001f3b2\ufe0f', scale=1).click(fn=lambda: -1, outputs=[seed], queue=False)
1108
+ reuse_seed = gr.Button('\u267b\ufe0f', scale=1)
1109
+
1110
+ with gr.Tab("Audio"):
1111
+ with gr.Row():
1112
+ with gr.Column():
1113
+ input_type = gr.Radio(["file", "mic"], value="file", label="Input Type (optional)", interactive=True)
1114
+ mode = gr.Radio(["melody", "sample"], label="Input Audio Mode (optional)", value="sample", interactive=True)
1115
+ with gr.Row():
1116
+ trim_start = gr.Number(label="Trim Start", value=0, interactive=True)
1117
+ trim_end = gr.Number(label="Trim End", value=0, interactive=True)
1118
+ audio = gr.Audio(source="upload", type="numpy", label="Input Audio (optional)", interactive=True)
1119
+
1120
+ with gr.Tab("Customization"):
1121
+ with gr.Row():
1122
+ with gr.Column():
1123
+ background = gr.ColorPicker(value="#0f0f0f", label="background color", interactive=True, scale=0)
1124
+ bar1 = gr.ColorPicker(value="#84cc16", label="bar color start", interactive=True, scale=0)
1125
+ bar2 = gr.ColorPicker(value="#10b981", label="bar color end", interactive=True, scale=0)
1126
+ with gr.Column():
1127
+ image = gr.Image(label="Background Image", type="filepath", interactive=True, scale=4)
1128
+ with gr.Row():
1129
+ height = gr.Number(label="Height", value=512, interactive=True)
1130
+ width = gr.Number(label="Width", value=768, interactive=True)
1131
+
1132
+ with gr.Tab("Settings"):
1133
+ with gr.Row():
1134
+ channel = gr.Radio(["mono", "stereo", "stereo effect"], label="Output Audio Channels", value="stereo", interactive=True, scale=1)
1135
+ sr_select = gr.Dropdown(["11025", "16000", "22050", "24000", "32000", "44100", "48000"], label="Output Audio Sample Rate", value="48000", interactive=True)
1136
+ with gr.Row():
1137
+ model = gr.Radio(["melody", "small", "medium", "large", "custom"], label="Model", value="large", interactive=True, scale=1)
1138
+ with gr.Column():
1139
+ dropdown = gr.Dropdown(choices=get_available_models(), value=("No models found" if len(get_available_models()) < 1 else get_available_models()[0]), label='Custom Model (models folder)', elem_classes='slim-dropdown', interactive=True)
1140
+ ui.create_refresh_button(dropdown, lambda: None, lambda: {'choices': get_available_models()}, 'refresh-button')
1141
+ basemodel = gr.Radio(["small", "medium", "melody", "large"], label="Base Model", value="medium", interactive=True, scale=1)
1142
+ with gr.Row():
1143
+ decoder = gr.Radio(["Default", "MultiBand_Diffusion"], label="Decoder", value="Default", interactive=True)
1144
+ with gr.Row():
1145
+ topk = gr.Number(label="Top-k", value=250, interactive=True)
1146
+ topp = gr.Number(label="Top-p", value=0, interactive=True)
1147
+ temperature = gr.Number(label="Temperature", value=1.0, interactive=True)
1148
+ cfg_coef = gr.Number(label="Classifier Free Guidance", value=3.0, interactive=True)
1149
+ with gr.Row():
1150
+ submit = gr.Button("Generate", variant="primary")
1151
+ # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
1152
+ _ = gr.Button("Interrupt").click(fn=interrupt, queue=False)
1153
+ with gr.Column() as c:
1154
+ with gr.Tab("Output"):
1155
+ output = gr.Video(label="Generated Music", scale=0)
1156
+ with gr.Row():
1157
+ audio_only = gr.Audio(type="numpy", label="Audio Only", interactive=False)
1158
+ backup_only = gr.Audio(type="numpy", label="Backup Audio", interactive=False, visible=False)
1159
+ send_audio = gr.Button("Send to Input Audio")
1160
+ seed_used = gr.Number(label='Seed used', value=-1, interactive=False)
1161
+ download = gr.File(label="Generated Files", interactive=False)
1162
  with gr.Tab("Wiki"):
1163
  gr.Markdown(
1164
  """