Corrected path for opennsfw model

This commit is contained in:
Osama Ghozlan 2023-06-17 02:07:26 +02:00
parent 08f17503d5
commit 2e110df5c2

View File

@ -1,35 +1,25 @@
{
"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": "code",
"source": [
"from google.colab import drive\n",
"drive.mount('/content/gdrive')"
],
"execution_count": null,
"metadata": {
"id": "pq3f83s2Jb3C"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"from google.colab import drive\n",
"drive.mount('/content/gdrive')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "SEAgT4YZJexL"
},
"outputs": [],
"source": [
"#@markdown # Install/Update roop\n",
"from IPython.display import clear_output\n",
@ -62,20 +52,14 @@
"!git pull\n",
"clear_output()\n",
"inf('\\u2714 Done','success', '50px')"
],
"metadata": {
"cellView": "form",
"id": "SEAgT4YZJexL"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9mpP8csoFKXt",
"cellView": "form"
"cellView": "form",
"id": "9mpP8csoFKXt"
},
"outputs": [],
"source": [
@ -118,8 +102,8 @@
"retry_count = 0\n",
"while retry_count < 3:\n",
" with capture.capture_output() as cap:\n",
" !wget -P ~/.opennsfw2 https://github.com/bhky/opennsfw2/releases/download/v0.1.0/open_nsfw_weights.h5\n",
" if not hash_mistmatch('/root/.opennsfw2/open_nsfw_weights.h5', '14ca261f48bdd88c1eecba96a761bd1579b523adae1b749b0a4ffd8b7ed8babe'):\n",
" !wget -P ~/.opennsfw2/weights https://github.com/bhky/opennsfw2/releases/download/v0.1.0/open_nsfw_weights.h5\n",
" if not hash_mistmatch('/root/.opennsfw2/weights/open_nsfw_weights.h5', '14ca261f48bdd88c1eecba96a761bd1579b523adae1b749b0a4ffd8b7ed8babe'):\n",
" retry_count = 0\n",
" break\n",
" retry_count += 1\n",
@ -141,6 +125,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "nnyfsTHvvosD"
},
"outputs": [],
"source": [
"#@markdown # Download example files\n",
"\n",
@ -154,16 +144,16 @@
"\n",
"clear_output()\n",
"inf('\\u2714 Done','success', '50px')"
],
"metadata": {
"cellView": "form",
"id": "nnyfsTHvvosD"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "xnSqGP3D5h-H"
},
"outputs": [],
"source": [
"#@markdown #**Select source image and target video**\n",
"\n",
@ -182,16 +172,16 @@
"OUT_VIDEO_NAME = path_to_output\n",
"\n",
"!python /content/gdrive/MyDrive/roop/run.py -f $source_path -t $target_path -o $path_to_output $kfps $kframes --gpu-vendor nvidia\n"
],
"metadata": {
"cellView": "form",
"id": "xnSqGP3D5h-H"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "3LF20NWxFi4j"
},
"outputs": [],
"source": [
"#@markdown #**Visualize Video Swap**\n",
"\n",
@ -202,13 +192,22 @@
"video_url = f\"data:video/mp4;base64,{b64encode(video_file).decode()}\"\n",
"\n",
"HTML(f\"\"\"<video width={800} controls><source src=\"{video_url}\"></video>\"\"\")"
],
"metadata": {
"cellView": "form",
"id": "3LF20NWxFi4j"
},
"execution_count": null,
"outputs": []
]
}
]
],
"metadata": {
"accelerator": "GPU",
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}