Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,30 +14,29 @@ image_client = Client("black-forest-labs/FLUX.1-schnell")
|
|
| 14 |
def master_logic(audio_path, brightness, loudness, reverb, steps, cfg):
|
| 15 |
if not audio_path: return None, None, "⚠️ Upload audio!", None
|
| 16 |
|
| 17 |
-
# 1. Detect Genre
|
| 18 |
results = classifier(audio_path)
|
| 19 |
genre = results[0]['label']
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
verb_txt = "spacious hall reverb" if reverb > 7 else ("dry intimate studio sound" if reverb < 3 else "natural room acoustics")
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
# 3. AI Mastering API
|
| 29 |
result = mastering_client.predict(
|
| 30 |
handle_file(audio_path),
|
| 31 |
full_prompt,
|
| 32 |
-
42,
|
| 33 |
int(steps),
|
| 34 |
float(cfg)
|
| 35 |
)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
status_msg = f"✅ **{genre}** Mastered with {int(steps)} steps at {cfg} intensity."
|
| 39 |
-
|
| 40 |
-
return mastered_file, mastered_file, status_msg, mastered_file
|
| 41 |
|
| 42 |
def art_logic(status_text, vibe, detail_steps, creativity_cfg):
|
| 43 |
if not status_text or "Ready" in status_text: return None
|
|
|
|
| 14 |
def master_logic(audio_path, brightness, loudness, reverb, steps, cfg):
|
| 15 |
if not audio_path: return None, None, "⚠️ Upload audio!", None
|
| 16 |
|
|
|
|
| 17 |
results = classifier(audio_path)
|
| 18 |
genre = results[0]['label']
|
| 19 |
|
| 20 |
+
# NEW: Professional Engineering Keywords
|
| 21 |
+
# We add "analog warmth" and "high headroom" to fight that "cheap" digital sound.
|
| 22 |
+
quality_boosters = "High-fidelity, analog warmth, 24-bit depth, wide stereo image, no digital clipping, no artifacts."
|
|
|
|
| 23 |
|
| 24 |
+
bright_txt = "shimmering top-end clarity" if brightness > 7 else ("vintage tube warmth" if brightness < 3 else "transparent EQ")
|
| 25 |
+
loud_txt = "commercial loudness with preserved transients" if loudness > 7 else ("audiophile dynamic range" if loudness < 3 else "balanced RMS levels")
|
| 26 |
+
verb_txt = "lush cinematic space" if reverb > 7 else ("dry precision studio" if reverb < 3 else "natural room")
|
| 27 |
+
|
| 28 |
+
# The "Secret Sauce" Prompt
|
| 29 |
+
full_prompt = f"Professional {genre} master: {bright_txt}, {loud_txt}, {verb_txt}. {quality_boosters}"
|
| 30 |
|
|
|
|
| 31 |
result = mastering_client.predict(
|
| 32 |
handle_file(audio_path),
|
| 33 |
full_prompt,
|
| 34 |
+
42,
|
| 35 |
int(steps),
|
| 36 |
float(cfg)
|
| 37 |
)
|
| 38 |
|
| 39 |
+
return result[0], result[0], f"✨ Premium {genre} Master Complete", result[0]
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
def art_logic(status_text, vibe, detail_steps, creativity_cfg):
|
| 42 |
if not status_text or "Ready" in status_text: return None
|