Skip to content

Commit

Permalink
Replacing colab notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
konieshadow committed Oct 12, 2023
1 parent b493493 commit 5fbf50b
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"colab": {
"private_outputs": true,
"provenance": [],
"gpuType": "T4",
"machine_shape": "hm"
"gpuType": "T4"
},
"kernelspec": {
"name": "python3",
Expand All @@ -27,29 +26,16 @@
"outputs": [],
"source": [
"%cd /content\n",
"!git clone https://github.com/konieshadow/Fooocus-API"
"!git clone -b colab https://github.com/konieshadow/Fooocus-API"
]
},
{
"cell_type": "code",
"source": [
"# Use virtualenv to avoid dependencies conflict\n",
"!pip install virtualenv\n",
"!virtualenv /content/venv"
],
"metadata": {
"id": "qMTMO8cqth0D"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"%cd /content/Fooocus-API\n",
"\n",
"!source /content/venv/bin/activate; pip install -r requirements.txt\n",
"!source /content/venv/bin/activate; pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118 xformers"
"!git pull origin colab\n",
"!pip install -r requirements.txt\n",
"!pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118 xformers"
],
"metadata": {
"id": "ZmeU8_76tuFa"
Expand All @@ -60,7 +46,10 @@
{
"cell_type": "code",
"source": [
"!npm install -g tunnelmole"
"%cd /content\n",
"!wget https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-unknown-linux-musl.tar.gz\n",
"!tar -zxvf bore-v0.5.0-x86_64-unknown-linux-musl.tar.gz\n",
"!chmod +x bore"
],
"metadata": {
"id": "eNsYjwFCjgju"
Expand All @@ -71,7 +60,9 @@
{
"cell_type": "code",
"source": [
"!source /content/venv/bin/activate; python -c \"from main import pre_setup; pre_setup(load_all_models=False)\""
"%cd /content/Fooocus-API\n",
"from main import pre_setup\n",
"pre_setup(load_all_models=False)"
],
"metadata": {
"id": "8GcxyUf5mnn-"
Expand All @@ -82,7 +73,9 @@
{
"cell_type": "code",
"source": [
"!source /content/venv/bin/activate; python main.py & tmole 8888"
"# Preload pipeline before start http server\n",
"# Open url in new tab from output \"listening at bore.pub:xxxx\" after you see \"Uvicorn running on http://127.0.0.1:8888\"\n",
"!python main.py --sync-repo skip --preload-pipeline & /content/bore local 8888 --to bore.pub"
],
"metadata": {
"id": "KI_nBjx0jc-2"
Expand Down

0 comments on commit 5fbf50b

Please sign in to comment.