Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -574,26 +574,6 @@ def ai_mastering_chain(audio_path, genre="Pop", target_lufs=-14.0):
|
|
| 574 |
audio.export(out_path, format="wav")
|
| 575 |
return out_path
|
| 576 |
|
| 577 |
-
# === Generate PDF Report ===
|
| 578 |
-
try:
|
| 579 |
-
from fpdf import FPDF
|
| 580 |
-
except ImportError:
|
| 581 |
-
print("FPDF not found β skipping PDF report for now")
|
| 582 |
-
|
| 583 |
-
class PDFReport(FPDF):
|
| 584 |
-
def header(self):
|
| 585 |
-
self.set_font('Arial', 'B', 12)
|
| 586 |
-
self.cell(0, 10, 'Studio Pulse AI - Session Report', ln=True, align='C')
|
| 587 |
-
|
| 588 |
-
def export_session_report(session_data):
|
| 589 |
-
pdf = PDFReport()
|
| 590 |
-
pdf.add_page()
|
| 591 |
-
pdf.set_font("Arial", size=10)
|
| 592 |
-
pdf.multi_cell(0, 10, txt=session_data)
|
| 593 |
-
out_path = os.path.join(tempfile.gettempdir(), "session_report.pdf")
|
| 594 |
-
pdf.output(out_path)
|
| 595 |
-
return out_path
|
| 596 |
-
|
| 597 |
# === Main UI β With Studio Pulse Branding ===
|
| 598 |
with gr.Blocks(css="""
|
| 599 |
body {
|
|
@@ -833,7 +813,7 @@ with gr.Blocks(css="""
|
|
| 833 |
gr.Textbox(label="Status", value="β
Ready", lines=1)
|
| 834 |
],
|
| 835 |
title="Batch Audio Processor",
|
| 836 |
-
description="Upload multiple files, apply effects in bulk, and download all results in a
|
| 837 |
flagging_mode="never",
|
| 838 |
submit_btn="Process All Files"
|
| 839 |
)
|
|
@@ -872,7 +852,9 @@ with gr.Blocks(css="""
|
|
| 872 |
gr.Interface(
|
| 873 |
fn=visualize_spectrum,
|
| 874 |
inputs=gr.Audio(label="Upload Track", type="filepath"),
|
| 875 |
-
outputs=gr.Image(label="Spectrum Analysis")
|
|
|
|
|
|
|
| 876 |
)
|
| 877 |
|
| 878 |
# --- Loudness Graph Tab β EBU R128 Matching ===
|
|
@@ -967,7 +949,7 @@ with gr.Blocks(css="""
|
|
| 967 |
fn=live_effect_preview,
|
| 968 |
inputs=[
|
| 969 |
gr.Audio(sources=["microphone"], streaming=True, label="Live Mic Input"),
|
| 970 |
-
gr.Dropdown(choices=["Normalize", "Reverb", "Pitch Shift", "Saturation"]
|
| 971 |
],
|
| 972 |
outputs=gr.Audio(label="Live Output", type="filepath"),
|
| 973 |
title="Preview Effects in Real-Time",
|
|
@@ -1008,7 +990,7 @@ with gr.Blocks(css="""
|
|
| 1008 |
],
|
| 1009 |
outputs=gr.Audio(label="Stretched Output", type="filepath"),
|
| 1010 |
title="Match Track to BPM",
|
| 1011 |
-
description="Stretch
|
| 1012 |
)
|
| 1013 |
|
| 1014 |
# --- A/B Compare ===
|
|
@@ -1122,35 +1104,4 @@ with gr.Blocks(css="""
|
|
| 1122 |
description="Perfect for sharing with producers or archiving"
|
| 1123 |
)
|
| 1124 |
|
| 1125 |
-
# --- Session Report Export (PDF) ===
|
| 1126 |
-
with gr.Tab("π Session Report"):
|
| 1127 |
-
gr.Interface(
|
| 1128 |
-
fn=export_session_report,
|
| 1129 |
-
inputs=gr.Textbox(label="Session Data (JSON)", lines=10),
|
| 1130 |
-
outputs=gr.File(label="Download PDF Report"),
|
| 1131 |
-
title="Export Detailed Session Report",
|
| 1132 |
-
description="For professional use or sharing with collaborators"
|
| 1133 |
-
)
|
| 1134 |
-
|
| 1135 |
-
# --- Effect Chains Marketplace β New Tab ===
|
| 1136 |
-
with gr.Tab("π§© Effect Chain Marketplace"):
|
| 1137 |
-
gr.Interface(
|
| 1138 |
-
fn=publish_effect_chain,
|
| 1139 |
-
inputs=[
|
| 1140 |
-
gr.Textbox(label="Effect Chain (JSON)", lines=2),
|
| 1141 |
-
gr.Textbox(label="Name", value="My Chain"),
|
| 1142 |
-
gr.CheckboxGroup(choices=["music", "vocals", "podcast", "radio", "edm"], label="Tags")
|
| 1143 |
-
],
|
| 1144 |
-
outputs=gr.JSON(label="Published Chain Info"),
|
| 1145 |
-
title="Publish Your Effect Chain",
|
| 1146 |
-
description="Share your setup with others"
|
| 1147 |
-
)
|
| 1148 |
-
|
| 1149 |
-
with gr.Tab("π§© Search Chains"):
|
| 1150 |
-
gr.Interface(
|
| 1151 |
-
fn=search_effect_chains,
|
| 1152 |
-
inputs=gr.Textbox(label="Search Query", value="vocal"),
|
| 1153 |
-
outputs=gr.JSON(label="Matching Chains")
|
| 1154 |
-
)
|
| 1155 |
-
|
| 1156 |
demo.launch()
|
|
|
|
| 574 |
audio.export(out_path, format="wav")
|
| 575 |
return out_path
|
| 576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
# === Main UI β With Studio Pulse Branding ===
|
| 578 |
with gr.Blocks(css="""
|
| 579 |
body {
|
|
|
|
| 813 |
gr.Textbox(label="Status", value="β
Ready", lines=1)
|
| 814 |
],
|
| 815 |
title="Batch Audio Processor",
|
| 816 |
+
description="Upload multiple files, apply effects in bulk, and download all results in a ZIP.",
|
| 817 |
flagging_mode="never",
|
| 818 |
submit_btn="Process All Files"
|
| 819 |
)
|
|
|
|
| 852 |
gr.Interface(
|
| 853 |
fn=visualize_spectrum,
|
| 854 |
inputs=gr.Audio(label="Upload Track", type="filepath"),
|
| 855 |
+
outputs=gr.Image(label="Spectrum Analysis"),
|
| 856 |
+
title="Real-Time Spectrum Analyzer",
|
| 857 |
+
description="See the frequency breakdown of your audio"
|
| 858 |
)
|
| 859 |
|
| 860 |
# --- Loudness Graph Tab β EBU R128 Matching ===
|
|
|
|
| 949 |
fn=live_effect_preview,
|
| 950 |
inputs=[
|
| 951 |
gr.Audio(sources=["microphone"], streaming=True, label="Live Mic Input"),
|
| 952 |
+
gr.Dropdown(choices=["Normalize", "Reverb", "Pitch Shift", "Saturation"]),
|
| 953 |
],
|
| 954 |
outputs=gr.Audio(label="Live Output", type="filepath"),
|
| 955 |
title="Preview Effects in Real-Time",
|
|
|
|
| 990 |
],
|
| 991 |
outputs=gr.Audio(label="Stretched Output", type="filepath"),
|
| 992 |
title="Match Track to BPM",
|
| 993 |
+
description="Stretch audio to match a specific tempo"
|
| 994 |
)
|
| 995 |
|
| 996 |
# --- A/B Compare ===
|
|
|
|
| 1104 |
description="Perfect for sharing with producers or archiving"
|
| 1105 |
)
|
| 1106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1107 |
demo.launch()
|