Spaces:
Build error
Build error
Commit
·
bb1950e
1
Parent(s):
d8d4bc1
Init web commit. Basic layout
Browse files- app.py +8 -3
- web/.eslintrc.json +3 -0
- web/.gitignore +35 -0
- web/README.md +34 -0
- web/next.config.js +4 -0
- web/package-lock.json +0 -0
- web/package.json +25 -0
- web/postcss.config.js +6 -0
- web/public/next.svg +1 -0
- web/public/vercel.svg +1 -0
- web/src/app/favicon.ico +0 -0
- web/src/app/globals.css +27 -0
- web/src/app/layout.tsx +22 -0
- web/src/app/page.tsx +60 -0
- web/tailwind.config.js +18 -0
- web/tsconfig.json +28 -0
app.py
CHANGED
@@ -205,7 +205,7 @@ def predict_full(text, melody, duration, topk, topp, temperature, cfg_coef, prog
|
|
205 |
[text], [melody], duration, progress=True,
|
206 |
top_k=topk, top_p=topp, temperature=temperature, cfg_coef=cfg_coef)
|
207 |
|
208 |
-
return outs[0], outs[1]
|
209 |
|
210 |
|
211 |
def toggle_audio_src(choice):
|
@@ -241,9 +241,13 @@ def ui_full(launch_kwargs):
|
|
241 |
with gr.Row():
|
242 |
# output_normal = gr.Video(label="Generated Music")
|
243 |
output_normal = gr.Audio(label="Generated Music")
|
|
|
|
|
244 |
with gr.Row():
|
245 |
# output_without_drum = gr.Video(label="Removed drums")
|
246 |
output_without_drum = gr.Audio(label="Removed drums")
|
|
|
|
|
247 |
with gr.Row():
|
248 |
gr.Markdown(
|
249 |
"""
|
@@ -252,7 +256,7 @@ def ui_full(launch_kwargs):
|
|
252 |
)
|
253 |
submit.click(predict_full,
|
254 |
inputs=[text, melody, duration, topk, topp, temperature, cfg_coef],
|
255 |
-
outputs=[output_normal, output_without_drum])
|
256 |
radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
|
257 |
gr.Markdown(
|
258 |
"""
|
@@ -317,6 +321,7 @@ if __name__ == "__main__":
|
|
317 |
|
318 |
# Load melody model
|
319 |
load_model()
|
320 |
-
os.
|
|
|
321 |
# Show the interface
|
322 |
ui_full(launch_kwargs)
|
|
|
205 |
[text], [melody], duration, progress=True,
|
206 |
top_k=topk, top_p=topp, temperature=temperature, cfg_coef=cfg_coef)
|
207 |
|
208 |
+
return outs[0], outs[1], outs[0], outs[1]
|
209 |
|
210 |
|
211 |
def toggle_audio_src(choice):
|
|
|
241 |
with gr.Row():
|
242 |
# output_normal = gr.Video(label="Generated Music")
|
243 |
output_normal = gr.Audio(label="Generated Music")
|
244 |
+
with gr.Row():
|
245 |
+
file_download = gr.File(label="Download")
|
246 |
with gr.Row():
|
247 |
# output_without_drum = gr.Video(label="Removed drums")
|
248 |
output_without_drum = gr.Audio(label="Removed drums")
|
249 |
+
with gr.Row():
|
250 |
+
file_download_no_drum = gr.File(label="Download")
|
251 |
with gr.Row():
|
252 |
gr.Markdown(
|
253 |
"""
|
|
|
256 |
)
|
257 |
submit.click(predict_full,
|
258 |
inputs=[text, melody, duration, topk, topp, temperature, cfg_coef],
|
259 |
+
outputs=[output_normal, output_without_drum, file_download, file_download_no_drum])
|
260 |
radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
|
261 |
gr.Markdown(
|
262 |
"""
|
|
|
321 |
|
322 |
# Load melody model
|
323 |
load_model()
|
324 |
+
if not os.path.exists("temp"):
|
325 |
+
os.mkdir("temp")
|
326 |
# Show the interface
|
327 |
ui_full(launch_kwargs)
|
web/.eslintrc.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"extends": "next/core-web-vitals"
|
3 |
+
}
|
web/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
2 |
+
|
3 |
+
# dependencies
|
4 |
+
/node_modules
|
5 |
+
/.pnp
|
6 |
+
.pnp.js
|
7 |
+
|
8 |
+
# testing
|
9 |
+
/coverage
|
10 |
+
|
11 |
+
# next.js
|
12 |
+
/.next/
|
13 |
+
/out/
|
14 |
+
|
15 |
+
# production
|
16 |
+
/build
|
17 |
+
|
18 |
+
# misc
|
19 |
+
.DS_Store
|
20 |
+
*.pem
|
21 |
+
|
22 |
+
# debug
|
23 |
+
npm-debug.log*
|
24 |
+
yarn-debug.log*
|
25 |
+
yarn-error.log*
|
26 |
+
|
27 |
+
# local env files
|
28 |
+
.env*.local
|
29 |
+
|
30 |
+
# vercel
|
31 |
+
.vercel
|
32 |
+
|
33 |
+
# typescript
|
34 |
+
*.tsbuildinfo
|
35 |
+
next-env.d.ts
|
web/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
2 |
+
|
3 |
+
## Getting Started
|
4 |
+
|
5 |
+
First, run the development server:
|
6 |
+
|
7 |
+
```bash
|
8 |
+
npm run dev
|
9 |
+
# or
|
10 |
+
yarn dev
|
11 |
+
# or
|
12 |
+
pnpm dev
|
13 |
+
```
|
14 |
+
|
15 |
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
16 |
+
|
17 |
+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
18 |
+
|
19 |
+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
20 |
+
|
21 |
+
## Learn More
|
22 |
+
|
23 |
+
To learn more about Next.js, take a look at the following resources:
|
24 |
+
|
25 |
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
26 |
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
27 |
+
|
28 |
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
29 |
+
|
30 |
+
## Deploy on Vercel
|
31 |
+
|
32 |
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
33 |
+
|
34 |
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
web/next.config.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** @type {import('next').NextConfig} */
|
2 |
+
const nextConfig = {}
|
3 |
+
|
4 |
+
module.exports = nextConfig
|
web/package-lock.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
web/package.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "web",
|
3 |
+
"version": "0.1.0",
|
4 |
+
"private": true,
|
5 |
+
"scripts": {
|
6 |
+
"dev": "next dev",
|
7 |
+
"build": "next build",
|
8 |
+
"start": "next start",
|
9 |
+
"lint": "next lint"
|
10 |
+
},
|
11 |
+
"dependencies": {
|
12 |
+
"@types/node": "20.4.2",
|
13 |
+
"@types/react": "18.2.15",
|
14 |
+
"@types/react-dom": "18.2.7",
|
15 |
+
"autoprefixer": "10.4.14",
|
16 |
+
"eslint": "8.45.0",
|
17 |
+
"eslint-config-next": "13.4.10",
|
18 |
+
"next": "13.4.10",
|
19 |
+
"postcss": "8.4.26",
|
20 |
+
"react": "18.2.0",
|
21 |
+
"react-dom": "18.2.0",
|
22 |
+
"tailwindcss": "3.3.3",
|
23 |
+
"typescript": "5.1.6"
|
24 |
+
}
|
25 |
+
}
|
web/postcss.config.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module.exports = {
|
2 |
+
plugins: {
|
3 |
+
tailwindcss: {},
|
4 |
+
autoprefixer: {},
|
5 |
+
},
|
6 |
+
}
|
web/public/next.svg
ADDED
|
web/public/vercel.svg
ADDED
|
web/src/app/favicon.ico
ADDED
|
web/src/app/globals.css
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tailwind base;
|
2 |
+
@tailwind components;
|
3 |
+
@tailwind utilities;
|
4 |
+
|
5 |
+
:root {
|
6 |
+
--foreground-rgb: 0, 0, 0;
|
7 |
+
--background-start-rgb: 214, 219, 220;
|
8 |
+
--background-end-rgb: 255, 255, 255;
|
9 |
+
}
|
10 |
+
|
11 |
+
@media (prefers-color-scheme: dark) {
|
12 |
+
:root {
|
13 |
+
--foreground-rgb: 255, 255, 255;
|
14 |
+
--background-start-rgb: 0, 0, 0;
|
15 |
+
--background-end-rgb: 0, 0, 0;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
body {
|
20 |
+
color: rgb(var(--foreground-rgb));
|
21 |
+
background: linear-gradient(
|
22 |
+
to bottom,
|
23 |
+
transparent,
|
24 |
+
rgb(var(--background-end-rgb))
|
25 |
+
)
|
26 |
+
rgb(var(--background-start-rgb));
|
27 |
+
}
|
web/src/app/layout.tsx
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import './globals.css'
|
2 |
+
import type { Metadata } from 'next'
|
3 |
+
import { Inter } from 'next/font/google'
|
4 |
+
|
5 |
+
const inter = Inter({ subsets: ['latin'] })
|
6 |
+
|
7 |
+
export const metadata: Metadata = {
|
8 |
+
title: 'Create Next App',
|
9 |
+
description: 'Generated by create next app',
|
10 |
+
}
|
11 |
+
|
12 |
+
export default function RootLayout({
|
13 |
+
children,
|
14 |
+
}: {
|
15 |
+
children: React.ReactNode
|
16 |
+
}) {
|
17 |
+
return (
|
18 |
+
<html lang="en">
|
19 |
+
<body className={inter.className}>{children}</body>
|
20 |
+
</html>
|
21 |
+
)
|
22 |
+
}
|
web/src/app/page.tsx
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use client'
|
2 |
+
|
3 |
+
import Image from 'next/image'
|
4 |
+
import { useState } from 'react';
|
5 |
+
|
6 |
+
export default function Home() {
|
7 |
+
const [length, setLength] = useState(10)
|
8 |
+
const [BPM, setBPM] = useState(120)
|
9 |
+
const [style, setStyle] = useState("")
|
10 |
+
|
11 |
+
function onLengthChange(e: React.ChangeEvent<HTMLInputElement>) {
|
12 |
+
setLength(Number(e.target.value))
|
13 |
+
}
|
14 |
+
function onBPMChange(e: React.ChangeEvent<HTMLInputElement>) {
|
15 |
+
setBPM(Number(e.target.value))
|
16 |
+
}
|
17 |
+
|
18 |
+
function handleStyleClick(style: String) {
|
19 |
+
console.log(style)
|
20 |
+
}
|
21 |
+
|
22 |
+
return (
|
23 |
+
<main className="flex min-h-screen flex-col items-center p-24">
|
24 |
+
<h1 className="text-6xl font-bold text-center">SoundSauce</h1>
|
25 |
+
<div className="flex flex-col items-center justify-center">Your unique flavor</div>
|
26 |
+
<div className="flex flex-col items-center justify-center m-20">
|
27 |
+
<div>Select a style</div>
|
28 |
+
<div className="grid grid-flow-row grid-cols-3 gap-x-2 gap-y-1 m-10">
|
29 |
+
{styles.map((style) => (
|
30 |
+
<button className="flex items-center justify-center border-2 border-white rounded-lg px-4 py-1 hover:bg-white" onClick={() => handleStyleClick(style)}>{style}</button>
|
31 |
+
))
|
32 |
+
}
|
33 |
+
</div>
|
34 |
+
<div className="flex w-full items-center justify-around">
|
35 |
+
<div className="flex flex-col items-center justify-center">
|
36 |
+
<div>Length</div>
|
37 |
+
<input type="range" min={1} max={20} step={1} value={length} onChange={onLengthChange} />
|
38 |
+
<div>{length} seconds</div>
|
39 |
+
</div>
|
40 |
+
<div className="flex flex-col items-center justify-center">
|
41 |
+
<div>BPM</div>
|
42 |
+
<input type="range" min={60} max={180} step={1} value={BPM} onChange={onBPMChange} />
|
43 |
+
<div>{BPM}</div>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
</main>
|
48 |
+
)
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
let styles = [
|
54 |
+
"Travis Scott",
|
55 |
+
"Drake",
|
56 |
+
"The Weeknd",
|
57 |
+
"Ambient",
|
58 |
+
"Spacey",
|
59 |
+
"Lofi",
|
60 |
+
]
|
web/tailwind.config.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** @type {import('tailwindcss').Config} */
|
2 |
+
module.exports = {
|
3 |
+
content: [
|
4 |
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
5 |
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
6 |
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
7 |
+
],
|
8 |
+
theme: {
|
9 |
+
extend: {
|
10 |
+
backgroundImage: {
|
11 |
+
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
12 |
+
'gradient-conic':
|
13 |
+
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
14 |
+
},
|
15 |
+
},
|
16 |
+
},
|
17 |
+
plugins: [],
|
18 |
+
}
|
web/tsconfig.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"compilerOptions": {
|
3 |
+
"target": "es5",
|
4 |
+
"lib": ["dom", "dom.iterable", "esnext"],
|
5 |
+
"allowJs": true,
|
6 |
+
"skipLibCheck": true,
|
7 |
+
"strict": true,
|
8 |
+
"forceConsistentCasingInFileNames": true,
|
9 |
+
"noEmit": true,
|
10 |
+
"esModuleInterop": true,
|
11 |
+
"module": "esnext",
|
12 |
+
"moduleResolution": "node",
|
13 |
+
"resolveJsonModule": true,
|
14 |
+
"isolatedModules": true,
|
15 |
+
"jsx": "preserve",
|
16 |
+
"incremental": true,
|
17 |
+
"plugins": [
|
18 |
+
{
|
19 |
+
"name": "next"
|
20 |
+
}
|
21 |
+
],
|
22 |
+
"paths": {
|
23 |
+
"@/*": ["./src/*"]
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
27 |
+
"exclude": ["node_modules"]
|
28 |
+
}
|