Spaces:
Sleeping
Sleeping
SynapseMedia Core Content Pipeline Fully Verified and Ready for Launch
Browse files
multimodal-engine/app/app.py
CHANGED
|
@@ -86,19 +86,36 @@ if uploaded_video is not None:
|
|
| 86 |
|
| 87 |
# Execute full workflow sequence if user initializes primary action call
|
| 88 |
if st.button("🚀 Process Complete AI Workflow", type="primary"):
|
| 89 |
-
# Switched to production .wav parameters to match high-precision processing models
|
| 90 |
audio_output_path = os.path.join(DATA_DIR, "extracted_audio.wav")
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
with st.status("🎙️ Phase 1: Separating and Transcribing Audio...", expanded=True) as status:
|
| 94 |
st.write("Demuxing 16kHz uncompressed mono track via FFmpeg...")
|
| 95 |
extract_audio_from_video(video_input_path, audio_output_path)
|
| 96 |
st.write("Transcribing audio tracks into structured Pydantic time models...")
|
| 97 |
st.session_state.transcript_obj = transcribe_audio(audio_output_path)
|
| 98 |
-
if st.session_state.transcript_obj is None:
|
| 99 |
-
status.update(label="Phase 1 Failed: Transcription returned no data.", state="error")
|
| 100 |
-
st.error("❌ Audio transcription failed — Gemini returned no structured output. Check your GEMINI_API_KEY and try again.")
|
| 101 |
-
st.stop()
|
| 102 |
status.update(label="Phase 1 Complete: Audio Transcript Secured!", state="complete")
|
| 103 |
|
| 104 |
# Phase 2 Step: Seeing
|
|
|
|
| 86 |
|
| 87 |
# Execute full workflow sequence if user initializes primary action call
|
| 88 |
if st.button("🚀 Process Complete AI Workflow", type="primary"):
|
|
|
|
| 89 |
audio_output_path = os.path.join(DATA_DIR, "extracted_audio.wav")
|
| 90 |
|
| 91 |
+
st.toast("Clearing stale assets from workspace memory...", icon="🧹")
|
| 92 |
+
|
| 93 |
+
# 1. Clear out previous audio WAV files
|
| 94 |
+
if os.path.exists(audio_output_path):
|
| 95 |
+
try:
|
| 96 |
+
os.remove(audio_output_path)
|
| 97 |
+
except Exception:
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
# 2. Clear out old keyframe images from previous analysis rounds
|
| 101 |
+
old_frames = glob.glob(os.path.join(FRAMES_DIR, "*.jpg"))
|
| 102 |
+
for frame_f in old_frames:
|
| 103 |
+
try:
|
| 104 |
+
os.remove(frame_f)
|
| 105 |
+
except Exception:
|
| 106 |
+
pass
|
| 107 |
+
old_rendered_reels = glob.glob(os.path.join(OUTPUT_CLIPS_DIR, "*.mp4"))
|
| 108 |
+
for reel_f in old_rendered_reels:
|
| 109 |
+
try:
|
| 110 |
+
os.remove(reel_f)
|
| 111 |
+
except Exception:
|
| 112 |
+
pass
|
| 113 |
+
|
| 114 |
with st.status("🎙️ Phase 1: Separating and Transcribing Audio...", expanded=True) as status:
|
| 115 |
st.write("Demuxing 16kHz uncompressed mono track via FFmpeg...")
|
| 116 |
extract_audio_from_video(video_input_path, audio_output_path)
|
| 117 |
st.write("Transcribing audio tracks into structured Pydantic time models...")
|
| 118 |
st.session_state.transcript_obj = transcribe_audio(audio_output_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
status.update(label="Phase 1 Complete: Audio Transcript Secured!", state="complete")
|
| 120 |
|
| 121 |
# Phase 2 Step: Seeing
|
multimodal-engine/app/workflow_engine.py
CHANGED
|
@@ -67,6 +67,7 @@ def generate_production_blog(audio_transcript: StructuredTranscript, visual_brea
|
|
| 67 |
- Incorporate structural elements like bullet points, summary tables, and bold code blocks cleanly.
|
| 68 |
- Blend the visual timeline shifts smoothly with the spoken words so it reads like a comprehensive, standalone web tutorial.
|
| 69 |
- Highlight keyboard shortcuts, timestamps, or interface menus mentioned on screen using bold text.
|
|
|
|
| 70 |
|
| 71 |
Do not add conversational commentary—return ONLY the markdown content.
|
| 72 |
"""
|
|
|
|
| 67 |
- Incorporate structural elements like bullet points, summary tables, and bold code blocks cleanly.
|
| 68 |
- Blend the visual timeline shifts smoothly with the spoken words so it reads like a comprehensive, standalone web tutorial.
|
| 69 |
- Highlight keyboard shortcuts, timestamps, or interface menus mentioned on screen using bold text.
|
| 70 |
+
- Omit call-to-action video catchphrases at the very end (e.g., discard speech elements asking to "like, share, comment, and subscribe").
|
| 71 |
|
| 72 |
Do not add conversational commentary—return ONLY the markdown content.
|
| 73 |
"""
|