{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "T4"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"source": [
"Follow my instagram : https://www.instagram.com/xsocialandapps"
],
"metadata": {
"id": "8UCd9oLtSkK9"
}
},
{
"cell_type": "markdown",
"source": [
"## Install dependencies"
],
"metadata": {
"id": "nq1Ytxi_gJnh"
}
},
{
"cell_type": "code",
"source": [
"%cd /content\n",
"!git clone https://github.com/zachysaur/MMAudio.git\n",
"%cd /content/MMAudio\n",
"!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118\n",
"!pip install -e ."
],
"metadata": {
"id": "tTiNYTWSgJKB"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Upload Video"
],
"metadata": {
"id": "NmJDTxMGhQdi"
}
},
{
"cell_type": "code",
"source": [
"from IPython.display import HTML\n",
"from base64 import b64encode\n",
"import ipywidgets as widgets\n",
"from IPython.display import display\n",
"\n",
"# Create a file upload widget\n",
"upload_widget = widgets.FileUpload(accept=\".mp4\", multiple=False)\n",
"\n",
"# Function to display the uploaded video\n",
"def display_video(change):\n",
" for file_name, file_info in upload_widget.value.items():\n",
" # Save the uploaded file\n",
" with open(file_name, 'wb') as f:\n",
" f.write(file_info['content'])\n",
"\n",
" # Convert the video to a base64 data URL\n",
" data_url = \"data:video/mp4;base64,\" + b64encode(open(file_name, 'rb').read()).decode()\n",
" display(HTML(f\"\"\"\n",
" \n",
" \"\"\"))\n",
"\n",
"# Observe changes to the upload widget\n",
"upload_widget.observe(display_video, names='value')\n",
"\n",
"# Display the widget\n",
"display(upload_widget)"
],
"metadata": {
"id": "3SYoUcUghlal"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"\n",
"# Prompt and Result"
],
"metadata": {
"id": "v_BM2f7niHm1"
}
},
{
"cell_type": "code",
"source": [
"!python demo.py --duration=10 --video=322875732015239177.mp4 --prompt \"Parrott singing ana song\"\n",
"\n",
"\n",
"from IPython.display import HTML\n",
"from base64 import b64encode\n",
"data_url = \"data:video/mp4;base64,\" + b64encode(open('./output/322875732015239177.mp4', 'rb').read()).decode()\n",
"HTML(\"\"\"\n",
"\n",
"\"\"\" % data_url)"
],
"metadata": {
"id": "xnhmnCkJiiAU"
},
"execution_count": null,
"outputs": []
}
]
}