Skip to content

A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.

fix(music_explorer): remove unresolved merge conflict markers

Rudy Celeklif91c042b51bd
diff --git a/audio/music_explorer/.env.example b/audio/music_explorer/.env.example
index 4525987..c5773bf 100644
--- a/audio/music_explorer/.env.example
+++ b/audio/music_explorer/.env.example
@@ -1,6 +1,3 @@
-<<<<<<< HEAD
-=======
# Gemini API key used for audio understanding via Gemini 3 Flash.
# Get one free at https://aistudio.google.com/app/apikey
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
GEMINI_API_KEY=your_gemini_api_key_here
diff --git a/audio/music_explorer/app.py b/audio/music_explorer/app.py
index 94416a7..9a710e6 100644
--- a/audio/music_explorer/app.py
+++ b/audio/music_explorer/app.py
@@ -1,9 +1,5 @@
"""
-<<<<<<< HEAD
-Music Explorer — Gemini-powered audio analysis
-=======
Music Explorer: Gemini-powered audio analysis.
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
Ask anything about any audio file or YouTube video.
Run: python app.py
"""
@@ -31,10 +27,7 @@ _yt_cache: dict[str, tuple[str, str]] = {} # url → (audio_path, title)
def _extract_video_id(url: str) -> str | None:
-<<<<<<< HEAD
-=======
"""Extract the 11-character video ID from a YouTube URL, or None if it doesn't match."""
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
patterns = [
r"(?:https?://)?(?:www\.)?youtube\.com/watch\?v=([^&=%?]{11})",
r"(?:https?://)?(?:www\.)?youtu\.be/([^&=%?]{11})",
@@ -48,10 +41,7 @@ def _extract_video_id(url: str) -> str | None:
def _youtube_embed(url: str) -> str:
-<<<<<<< HEAD
-=======
"""Build an HTML iframe embed for the given YouTube URL, or an empty string if invalid."""
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
vid = _extract_video_id(url)
if not vid:
return ""
@@ -65,10 +55,7 @@ def _youtube_embed(url: str) -> str:
def download_youtube(url: str, force: bool = False) -> tuple[str | None, str]:
-<<<<<<< HEAD
-=======
"""Download a YouTube video's audio as MP3, using a cached copy unless force is set."""
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
url = url.strip()
if not _extract_video_id(url):
return None, "❌ Invalid YouTube URL."
@@ -364,10 +351,7 @@ with gr.Blocks(title="Music Explorer") as demo:
# ── Event wiring ──────────────────────────────────────────────────────────
def load_yt(url):
-<<<<<<< HEAD
-=======
"""Download the YouTube URL's audio and return the audio path, status, and embed."""
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
if not url.strip():
return None, gr.update(value="❌ Enter a URL first.", visible=True), gr.update(visible=False)
path, msg = download_youtube(url.strip(), force=True)
@@ -385,10 +369,7 @@ with gr.Blocks(title="Music Explorer") as demo:
)
def clear_yt():
-<<<<<<< HEAD
-=======
"""Reset the YouTube URL field, audio input, status, and embed."""
->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a
return "", None, gr.update(value="", visible=False), gr.update(visible=False)
yt_clear_btn.click(fn=clear_yt, outputs=[yt_url, audio_input, yt_status, yt_embed])