Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,9 @@ from TTS.api import TTS
|
|
| 22 |
import base64
|
| 23 |
import pickle
|
| 24 |
import json
|
| 25 |
-
import soundfile as
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Suppress warnings
|
| 28 |
warnings.filterwarnings("ignore")
|
|
@@ -577,22 +579,27 @@ def ai_mastering_chain(audio_path, genre="Pop", target_lufs=-14.0):
|
|
| 577 |
# === Generate PDF Report ===
|
| 578 |
try:
|
| 579 |
from fpdf import FPDF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
except ImportError:
|
| 581 |
-
print("FPDF not found – skipping PDF report
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 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="""
|
|
|
|
| 22 |
import base64
|
| 23 |
import pickle
|
| 24 |
import json
|
| 25 |
+
import soundfile as SF
|
| 26 |
+
pip install fpdf
|
| 27 |
+
|
| 28 |
|
| 29 |
# Suppress warnings
|
| 30 |
warnings.filterwarnings("ignore")
|
|
|
|
| 579 |
# === Generate PDF Report ===
|
| 580 |
try:
|
| 581 |
from fpdf import FPDF
|
| 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 |
except ImportError:
|
| 598 |
+
print("FPDF not found – skipping PDF report.")
|
| 599 |
+
|
| 600 |
+
def export_session_report(session_data):
|
| 601 |
+
# Return None or a friendly message as a fallback
|
| 602 |
+
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 603 |
|
| 604 |
# === Main UI – With Studio Pulse Branding ===
|
| 605 |
with gr.Blocks(css="""
|