ghostai1 commited on
Commit
24bb87e
·
verified ·
1 Parent(s): 498e482

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -96
README.md CHANGED
@@ -1,106 +1,43 @@
1
  ---
2
  title: GHOSTSONALIVEZERO
3
- emoji: 📈
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 5.31.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
- short_description: alot of local zero build
12
  ---
13
- GhostAI Music Generator
14
-
15
- License: MIT
16
- Python: 3.10
17
- CUDA: 11.8 | 12.1
18
-
19
- The GhostAI Music Generator is a web-based demo hosted in a Hugging Face Space, powered by Meta AI's facebook/musicgen-medium model. It creates high-quality instrumental tracks across genres like Red Hot Chili Peppers-inspired funk rock, Nirvana-style grunge, Detroit techno, and more. Tracks are generated with structured sections (intros, verses, choruses) and delivered as 128 kbps MP3 files with metadata. Audio enhancements include equalization and fade effects for a polished sound. The demo runs in a pre-configured Gradio interface within a container, requiring no local setup.
20
-
21
- - License: MIT
22
- - Tags: Python, AI, Music Generation
23
-
24
- Features
25
-
26
- - Genre Versatility: Supports funk rock, grunge, techno, house, and more with customizable prompts.
27
- - Structured Compositions: Generates tracks with dynamic intros, verses, and choruses.
28
- - Audio Enhancements:
29
- - Equalization: Low-pass at 8000 Hz, high-pass at 80 Hz.
30
- - Fade Effects: 1000ms fade-in and fade-out.
31
- - Normalization: Headroom set to -9.0 dB.
32
- - Output: 128 kbps MP3 files with metadata.
33
- - Interface: Gradio UI for easy interaction in the Hugging Face Space.
34
-
35
- Using the Demo
36
-
37
- In the Gradio interface:
38
- - Select a Genre: Choose from Red Hot Chili Peppers, Nirvana, Pearl Jam, Foo Fighters, Detroit Techno, Deep House, etc.
39
- - Custom Prompt: Enter a description, e.g.:
40
- Instrumental funk rock, Red Hot Chili Peppers-inspired vibe with groovy basslines, syncopated guitar riffs, and funky breakdowns at 120 BPM.
41
- - Adjust Parameters:
42
- - CFG Scale: Default 3.0 (1.0-10.0, controls prompt adherence).
43
- - Top-K Sampling: Default 250 (10-500, limits token sampling).
44
- - Top-P Sampling: Default 0.9 (0.0-1.0, controls probability threshold).
45
- - Temperature: Default 1.0 (0.1-2.0, adjusts randomness).
46
- - Song Length: Default 30 seconds (30, 60, 90, or 120 seconds).
47
- - Chunk Duration: Default 10 seconds (5-15 seconds, for memory optimization).
48
- - Crossfade Duration: Default 1000 ms (100-2000 ms, for smooth transitions).
49
- - Tempo (BPM): Default 120 (60-180, sets track tempo).
50
- - Drum Beat, Synthesizer, Rhythmic Steps, Bass Style, Guitar Style: Customize with dropdowns (e.g., "slap bass", "distorted guitar").
51
- - Generate Music: Click "Generate Music" to create the track. Output is saved as output_cleaned.mp3 and playable in the interface.
52
-
53
- Troubleshooting
54
-
55
- - No Output: Ensure a valid prompt is entered. Check status messages for errors.
56
- - Poor Quality: Adjust temperature (e.g., 1.2 for more variety) or top_k (e.g., 300) in the interface.
57
- - Choppy Transitions: Increase crossfade duration (e.g., 1500 ms) or reduce chunk duration (e.g., 8 seconds).
58
- - GPU Not Detected: If you see "WARNING: Running on CPU", the Space may not be configured for GPU usage. To fix:
59
- - Go to the Space settings and ensure a GPU runtime is selected (e.g., NVIDIA T4 or A10G).
60
- - Verify the Space has access to a GPU by checking the "Hardware" settings.
61
- - Restart the Space after enabling GPU support.
62
- - If the issue persists, contact Hugging Face support to ensure NVIDIA drivers and NVML are properly configured in the container.
63
- - Model Loading Errors: If you see errors about PyTorch compatibility, ensure PyTorch 2.3.1 is installed (see Environment Setup).
64
-
65
- Customization
66
-
67
- To add a new genre, modify app.py:
68
- python
69
- def set_new_genre_prompt(bpm, drum_beat, synthesizer, rhythmic_steps, bass_style, guitar_style):
70
- rhythm = f" with {rhythmic_steps}" if rhythmic_steps != "none" else "steady rhythmic flow"
71
- drum = f", {drum_beat} drums" if drum_beat != "none" else ""
72
- synth = f", {synthesizer} accents" if synthesizer != "none" else ""
73
- bass = f", {bass_style}" if bass_style != "none" else ", deep bass"
74
- guitar = f", {guitar_style} guitars" if guitar_style != "none" else ", clean guitars"
75
- return f"Instrumental new genre{bass}{guitar}{drum}{synth}, inspired vibe, {rhythm} at {bpm} BPM."
76
- Add a button:
77
- python
78
- new_genre_btn = gr.Button("New Genre", elem_classes="genre-btn")
79
- new_genre_btn.click(set_new_genre_prompt, inputs=[bpm, drum_beat, synthesizer, rhythmic_steps, bass_style, guitar_style], outputs=instrumental_prompt)
80
-
81
- To use a smaller model for faster generation, update app.py:
82
- python
83
- musicgen_model = MusicGen.get_pretrained('facebook/musicgen-small', device=device)
84
-
85
- Environment Setup
86
-
87
- The demo requires a Hugging Face token for model access:
88
- - The HF_TOKEN environment variable is already set in the Space settings with your token from https://huggingface.co/settings/tokens.
89
- - Ensure access to facebook/musicgen-medium is granted via your Hugging Face account.
90
- - Update dependencies in requirements.txt to use PyTorch 2.3.1:
91
- torch==2.3.1
92
- torchaudio==2.3.1
93
- audiocraft
94
- gradio
95
- pydub
96
- numpy==1.23.5
97
- psutil
98
- huggingface_hub
99
-
100
- Acknowledgments
101
-
102
- - Meta AI for musicgen-medium and Audiocraft.
103
- - Hugging Face for hosting and CLI tools.
104
- - Gradio for the web interface.
105
- - pydub for audio processing.
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: GHOSTSONALIVEZERO
3
+ emoji: 🎵
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: "3.50.2"
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
+ short_description: Zero-GPU-friendly MusicGen demo
12
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ <h1 align="center">
15
+ 🎧 GhostAI Music Generator &mdash; *Alive on Zero* 📈
16
+ </h1>
17
+
18
+ > **Create fully-instrumental tracks in your browser—no DAW, no plugins, no GPU required.**
19
+ > Powered by Meta AI’s **facebook/musicgen-medium** model and wrapped in an ergonomic Gradio UI.
20
+
21
+ <p align="center">
22
+ <img alt="GhostAI waveform banner" width="80%" src="https://placehold.co/900x180/151515/FFFFFF?text=GhostAI%20Music%20Generator">
23
+ </p>
24
+
25
+ ## ✨ Features
26
+ | ⚙️ Capability | 🎯 Details |
27
+ |---|---|
28
+ | **Genre buttons** | One-click prompts for RHCP funk rock, 90’s grunge, Detroit techno, deep house, & more |
29
+ | **Structured output** | Automatic intros, verses & choruses at 128 kbps MP3 |
30
+ | **Audio polish** | Low-pass 8 kHz · High-pass 80 Hz · Fade-in/out 1 s · Headroom −9 dB |
31
+ | **ZeroGPU ready** | Runs happily on CPU Spaces (or CUDA 11.8 / 12.1 if a GPU is available) |
32
+ | **Fully configurable** | CFG scale, top-k/p, temperature, length, chunk & cross-fade sliders |
33
+
34
+ ## 🚀 Quick Start
35
+ 1. **Open the Space** – the Gradio panel loads automatically.
36
+ 2. **Pick a genre** *or* type a custom prompt.
37
+ 3. **Tweak the sliders** (tempo, length, cross-fade …) to taste.
38
+ 4. **Hit “Generate Music”** – after a short wait your MP3 appears, ready to download.
39
+
40
+ Example custom prompt:
41
+ ```text
42
+ Instrumental funk rock, Red Hot Chili Peppers energy, groovy basslines,
43
+ syncopated guitar riffs, funky breakdowns at 120 BPM.