Spaces:
Runtime error
Runtime error
File size: 1,817 Bytes
158fb03 8c37893 158fb03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "PeEyOhUDHhzF"
},
"outputs": [],
"source": [
"import os\n",
"import subprocess\n",
"\n",
"ROOT_DIR = \"/content\"\n",
"REPO_URL = \"https://huggingface.co/spaces/Linaqruf/animagine-xl\"\n",
"REPO_DIR = os.path.join(ROOT_DIR, \"animagine-xl-gui\")\n",
"\n",
"os.environ[\"HF_TOKEN\"] = \"\"\n",
"os.environ[\"ENABLE_REFINER_PROMPT\"] = \"1\"\n",
"\n",
"def clone(url, dir, branch=None):\n",
" subprocess.run([\"git\", \"clone\", url, dir], check=True)\n",
" if branch:\n",
" subprocess.run([\"git\", \"checkout\", branch], cwd=dir, check=True)\n",
"\n",
"def install_deps(dir):\n",
" subprocess.run([\"pip\", \"install\", \"-r\", \"requirements.txt\"], cwd=dir, check=True)\n",
"\n",
"def main():\n",
" if not os.path.exists(REPO_DIR):\n",
" print(f\"Cloning Repository to {REPO_DIR}\")\n",
" clone(REPO_URL, REPO_DIR)\n",
" print(f\"Installing required python libraries\")\n",
" install_deps(REPO_DIR)\n",
" print(\"Done!\")\n",
"\n",
" os.chdir(REPO_DIR)\n",
" !python app.py\n",
"\n",
"if __name__ == \"__main__\":\n",
" main()\n"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"machine_shape": "hm",
"provenance": [],
"gpuType": "A100"
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
} |