File size: 2,986 Bytes
c555b4d
de0fe6c
4fa21e4
de0fe6c
4fa21e4
c555b4d
4fa21e4
c555b4d
 
de0fe6c
 
4fa21e4
 
 
de0fe6c
 
4fa21e4
6f6cec1
 
c555b4d
 
de0fe6c
4fa21e4
de0fe6c
 
 
 
4fa21e4
 
 
 
de0fe6c
 
 
 
 
 
 
 
4fa21e4
de0fe6c
4fa21e4
 
 
 
 
de0fe6c
 
4fa21e4
 
6f6cec1
 
de0fe6c
6f6cec1
 
de0fe6c
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: YuE2-Jam
emoji: 🎤
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 6.24.0
app_file: app.py
pinned: false
license: cc-by-nc-4.0
short_description: Describe any song, YuE2 writes & sings it
startup_duration_timeout: 1h
suggested_hardware: zero-a10g
models:
  - m-a-p/YuE2-3B
  - m-a-p/YuE2-Vae
  - Tongyi-MAI/Z-Image-Turbo
tags:
  - mcp-server
---

# YuE2-Jam

Describe any song in plain English. An LLM writes the title, a YuE2 style prompt and section-tagged
lyrics, then [YuE2-3B](https://huggingface.co/m-a-p/YuE2-3B) plans a melody-and-chords score and
sings the full song (48 kHz stereo). Songs can be shared to a community feed (stored in the
`Mike0021/yue2-jam-community` bucket, each with its creation date).

## How it works

- **Compose** (CPU): `composer.py` calls an LLM on the HF Inference Router and returns
  `{title, tags, style, lyrics}`: `style` is a line of comma-separated descriptors (language, genre,
  singer, instruments, mood, BPM) as in the official examples; `lyrics` use YuE2's section tags
  (`[Intro]`, `[Verse]`, `[Pre-Chorus]`, `[Chorus]`, `[Bridge]`, `[Interlude]`, `[Outro]`).
- **Sing** (ZeroGPU): `engine.py` runs the official `yue2_infer` package from the model repo
  (installed with `--no-deps`; see `requirements.txt`): ABC score planning (`cot="full"`), 25 Hz
  semantic tokens, flow matching, then the [YuE2-Vae](https://huggingface.co/m-a-p/YuE2-Vae) decoder.
  YuE2 sets the song length from the lyrics; the requested duration caps it (fade-out if the cap is
  hit). Lyrics made only of section tags render an instrumental without a score plan (`cot="off"`).
  Cover art comes from Z-Image-Turbo in the same GPU allocation.
- **Share**: MP3 + cover + `meta.json` are written to the bucket mounted at `/data`; the feed is served
  from memory.

## API

- `POST /create(description, audio_duration, seed, community, instrumental)` streams status JSON then the
  final result `{audio, title, tags, lyrics, style, seed, duration, created_at, thumbnail?, community_url?}`.
- `POST /generate(style, lyrics, audio_duration, seed, title, tags, community, cover_word)` for explicit inputs.
- `POST /community()` returns the newest shared songs.

The same three endpoints are also exposed as MCP tools (`create`, `generate`, `community`) via Gradio's
built-in `mcp_server=True` — schema and description come straight from each function's type hints and
docstring, no extra code. MCP endpoint (streamable HTTP): `https://mike0021-yue2-jam.hf.space/gradio_api/mcp`
(legacy SSE transport at `/gradio_api/mcp/sse`; add `?tools=create,community` to either to expose only a subset).

Requires the `HF_TOKEN` secret (composer LLM) and the bucket volume `hf://buckets/Mike0021/yue2-jam-community:/data`.

YuE2 weights are released under [CC BY-NC 4.0](https://huggingface.co/m-a-p/YuE2-3B/blob/main/LICENSE):
non-commercial use only. The header mark is the YuE logo (Apache 2.0) from the
[YuE2 project page](https://map-yue2.github.io/).