Skip to content

Commit

Permalink
Adding documentation notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
IdkwhatImD0ing committed Mar 25, 2024
1 parent 3be69e1 commit f9a6420
Show file tree
Hide file tree
Showing 5 changed files with 518 additions and 2 deletions.
200 changes: 200 additions & 0 deletions examples/custom_lyrics.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from suno import SongsGen\n",
"from dotenv import load_dotenv\n",
"import os\n",
"load_dotenv() \n",
"\n",
"SUNO_COOKIE = os.getenv(\"SUNO_COOKIE\")\n",
"i = SongsGen(SUNO_COOKIE)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Waiting for results<span style=\"color: #808000; text-decoration-color: #808000\">...</span>\n",
"</pre>\n"
],
"text/plain": [
"Waiting for results\u001b[33m...\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output = i.get_songs_custom(\"\"\"(Verse 1)\n",
"Wake up, boot up, it’s a brand new day,\n",
"Open my laptop, where the code awaits.\n",
"GitHub’s buzzing, community's alive,\n",
"With open source, our dreams start to take flight.\n",
"\n",
"(Chorus)\n",
"Fork it, clone it, make it your own,\n",
"Push a commit, then you watch it grow.\n",
"Issues and pull requests, let's get 'em merged,\n",
"In the world of code, we surf the surge.\n",
"\n",
"(Verse 2)\n",
"Collaboration like the world's never seen,\n",
"On screens apart, but together we dream.\n",
"A patch, a feature, a bug squashed away,\n",
"In open source, we all have a say.\n",
"\n",
"(Chorus)\n",
"Fork it, clone it, make it your own,\n",
"Push a commit, then you watch it grow.\n",
"Issues and pull requests, let's get 'em merged,\n",
"In the world of code, we surf the surge.\"\"\", \"upbeat pop\")\n",
"link = output['song_url']"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"(Verse 1)\n",
"Wake up, boot up, it’s a brand new day,\n",
"Open my laptop, where the code awaits.\n",
"GitHub’s buzzing, community's alive,\n",
"With open source, our dreams start to take flight.\n",
"\n",
"(Chorus)\n",
"Fork it, clone it, make it your own,\n",
"Push a commit, then you watch it grow.\n",
"Issues and pull requests, let's get 'em merged,\n",
"In the world of code, we surf the surge.\n",
"\n",
"(Verse 2)\n",
"Collaboration like the world's never seen,\n",
"On screens apart, but together we dream.\n",
"A patch, a feature, a bug squashed away,\n",
"In open source, we all have a say.\n",
"\n",
"(Chorus)\n",
"Fork it, clone it, make it your own,\n",
"Push a commit, then you watch it grow.\n",
"Issues and pull requests, let's get 'em merged,\n",
"In the world of code, we surf the surge.\n"
]
}
],
"source": [
"print(output['song_name'])\n",
"print(output['lyric'])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"audio = i.get_mp3(link, stream=True)\n",
"for chunk in audio:\n",
" if chunk:\n",
" with open(\"custom_song.mp3\", \"ab\") as f:\n",
" f.write(chunk)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "mad",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added examples/custom_song.mp3
Binary file not shown.
Loading

0 comments on commit f9a6420

Please sign in to comment.