Spaces:
Sleeping
Sleeping
Update simpler_app.py
Browse files- simpler_app.py +21 -3
simpler_app.py
CHANGED
@@ -94,16 +94,34 @@ lyrics: {lyrics}
|
|
94 |
"""
|
95 |
|
96 |
prompt = f"{instruction.strip()}</s>"
|
97 |
-
outputs = pipe(prompt, max_new_tokens=
|
98 |
pattern = r'\<\|system\|\>(.*?)\<\|assistant\|\>'
|
99 |
cleaned_text = re.sub(pattern, '', outputs[0]["generated_text"], flags=re.DOTALL)
|
100 |
|
101 |
print(f"SUGGESTED Lyrics: {cleaned_text}")
|
102 |
return cleaned_text.lstrip("\n")
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
def general_process(theme, tags, lyrics):
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
107 |
|
108 |
|
109 |
with gr.Blocks() as demo:
|
|
|
94 |
"""
|
95 |
|
96 |
prompt = f"{instruction.strip()}</s>"
|
97 |
+
outputs = pipe(prompt, max_new_tokens=512, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
98 |
pattern = r'\<\|system\|\>(.*?)\<\|assistant\|\>'
|
99 |
cleaned_text = re.sub(pattern, '', outputs[0]["generated_text"], flags=re.DOTALL)
|
100 |
|
101 |
print(f"SUGGESTED Lyrics: {cleaned_text}")
|
102 |
return cleaned_text.lstrip("\n")
|
103 |
|
104 |
+
from gradio_client import Client
|
105 |
+
def generate_audio_ref(tags):
|
106 |
+
|
107 |
+
client = Client("declare-lab/mustango")
|
108 |
+
result = client.predict(
|
109 |
+
prompt=tags,
|
110 |
+
steps=200,
|
111 |
+
guidance=3,
|
112 |
+
api_name="/predict"
|
113 |
+
)
|
114 |
+
print(result)
|
115 |
+
|
116 |
+
return result
|
117 |
+
|
118 |
def general_process(theme, tags, lyrics):
|
119 |
+
gr.Info("Generating Lyrics")
|
120 |
+
lyrics_result = prepare_lyrics_with_llm(theme, tags, lyrics)
|
121 |
+
|
122 |
+
gr.Info("Generating audio ref")
|
123 |
+
audio_ref = generate_audio_ref(tags)
|
124 |
+
return audio_ref, lyrics_result
|
125 |
|
126 |
|
127 |
with gr.Blocks() as demo:
|