Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
4bdul4ziz committed Jan 14, 2023
0 parents commit 29f7daa
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.DS_Store
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An light weight package to implement stable diffusion in the most beginner friendly way possible.
123 changes: 123 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
accelerate==0.15.0
accelerator==2022.8.4.dev1
anyio @ file:///home/conda/feedstock_root/build_artifacts/anyio_1666191106763/work/dist
argcomplete @ file:///home/conda/feedstock_root/build_artifacts/argcomplete_1618899916290/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1671632566681/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1618230623929/work
beautifulsoup4 @ file:///home/conda/feedstock_root/build_artifacts/beautifulsoup4_1649463573192/work
boa @ file:///home/conda/feedstock_root/build_artifacts/boa_1670322301599/work
bottle==0.12.23
brotlipy @ file:///Users/runner/miniforge3/conda-bld/brotlipy_1666764778428/work
catkin-pkg @ file:///home/conda/feedstock_root/build_artifacts/catkin_pkg_1653705059873/work
catkin-tools @ file:///home/conda/feedstock_root/build_artifacts/catkin_tools_1654801778770/work
certifi==2022.12.7
cffi @ file:///Users/runner/miniforge3/conda-bld/cffi_1671179432479/work
chardet @ file:///Users/runner/miniforge3/conda-bld/chardet_1669990802682/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1661170624537/work
colcon-argcomplete @ file:///home/conda/feedstock_root/build_artifacts/colcon-argcomplete_1649143410380/work
colcon-bash @ file:///home/conda/feedstock_root/build_artifacts/colcon-bash_1649143583193/work
colcon-cd @ file:///home/conda/feedstock_root/build_artifacts/colcon-cd_1649143092283/work
colcon-cmake @ file:///home/conda/feedstock_root/build_artifacts/colcon-cmake_1661994787045/work
colcon-common-extensions @ file:///Users/runner/miniforge3/conda-bld/colcon-common-extensions_1667471581962/work
colcon-core @ file:///home/conda/feedstock_root/build_artifacts/colcon-core_1656567244141/work
colcon-defaults==0.2.5
colcon-devtools==0.2.2
colcon-library-path==0.2.1
colcon-metadata @ file:///home/conda/feedstock_root/build_artifacts/colcon-metadata_1597041627739/work
colcon-notification==0.2.15
colcon-output @ file:///home/conda/feedstock_root/build_artifacts/colcon-output_1601935752417/work
colcon-package-information==0.3.3
colcon-package-selection @ file:///home/conda/feedstock_root/build_artifacts/colcon-package-selection_1602006931176/work
colcon-parallel-executor==0.2.4
colcon-pkg-config==0.1.0
colcon-powershell==0.3.6
colcon-python-setup-py @ file:///home/conda/feedstock_root/build_artifacts/colcon-python-setup-py_1601954456112/work
colcon-recursive-crawl==0.2.1
colcon-ros @ file:///home/conda/feedstock_root/build_artifacts/colcon-ros_1649749142690/work
colcon-test-result==0.3.8
colcon-zsh @ file:///home/conda/feedstock_root/build_artifacts/colcon-zsh_1649143257569/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
coloredlogs @ file:///home/conda/feedstock_root/build_artifacts/coloredlogs_1643220139154/work
commonmark==0.9.1
conda==22.11.1
conda-build==3.23.3
conda-package-handling @ file:///home/conda/feedstock_root/build_artifacts/conda-package-handling_1669907009957/work
conda_package_streaming @ file:///home/conda/feedstock_root/build_artifacts/conda-package-streaming_1669733752472/work
coverage @ file:///Users/runner/miniforge3/conda-bld/coverage_1673418039504/work
cryptography @ file:///Users/runner/miniforge3/conda-bld/cryptography-split_1672673493910/work
customtkinter==5.0.3
darkdetect==0.8.0
dataclasses @ file:///home/conda/feedstock_root/build_artifacts/dataclasses_1628958434797/work
diffusers==0.11.1
distlib @ file:///home/conda/feedstock_root/build_artifacts/distlib_1668356257807/work
docutils @ file:///Users/runner/miniforge3/conda-bld/docutils_1666754975688/work
empy==3.3.4
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1671811474537/work
filelock @ file:///home/conda/feedstock_root/build_artifacts/filelock_1672354931606/work
future @ file:///home/conda/feedstock_root/build_artifacts/future_1673596611778/work
glob2==0.7
huggingface-hub==0.11.1
humanfriendly @ file:///Users/runner/miniforge3/conda-bld/humanfriendly_1667490035047/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1672612343532/work
importlib-resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1672681417544/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1673103042956/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1654302431367/work
joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1663332044897/work
json5 @ file:///tmp/build/80754af9/json5_1624432770122/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema-meta_1669810440410/work
libarchive-c @ file:///Users/runner/miniforge3/conda-bld/python-libarchive-c_1666852530305/work
libmambapy @ file:///Users/runner/miniforge3/conda-bld/mamba-split_1671598594473/work/libmambapy
mamba @ file:///Users/runner/miniforge3/conda-bld/mamba-split_1671598594473/work/mamba
MarkupSafe @ file:///Users/runner/miniforge3/conda-bld/markupsafe_1666770330366/work
numpy @ file:///Users/runner/miniforge3/conda-bld/numpy_1672415759761/work
osrf-pycommon @ file:///home/conda/feedstock_root/build_artifacts/osrf_pycommon_1626758968833/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1673482170163/work
Pillow @ file:///Users/runner/miniforge3/conda-bld/pillow_1672675372759/work
pkginfo @ file:///home/conda/feedstock_root/build_artifacts/pkginfo_1673281726124/work
pkgutil_resolve_name @ file:///home/conda/feedstock_root/build_artifacts/pkgutil-resolve-name_1633981968097/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1667232663820/work
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1670414775770/work
psutil @ file:///Users/runner/miniforge3/conda-bld/psutil_1667885951924/work
pycosat @ file:///Users/runner/miniforge3/conda-bld/pycosat_1666836597919/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
pygame==2.1.2
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1672682006896/work
pygraphviz @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_5862d525-bfb5-4474-a5b1-03cdcfb24413fkx4gm3v/croots/recipe/pygraphviz_1657200542356/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1672659226110/work
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1652235407899/work
pyrsistent @ file:///Users/runner/miniforge3/conda-bld/pyrsistent_1672681609473/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work
pytest==7.2.0
pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1664412836798/work
pytest-repeat @ file:///home/conda/feedstock_root/build_artifacts/pytest-repeat_1647874097344/work
pytest-rerunfailures @ file:///home/conda/feedstock_root/build_artifacts/pytest-rerunfailures_1673539277236/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1671365381334/work
PyYAML @ file:///Users/runner/miniforge3/conda-bld/pyyaml_1666772466414/work
regex==2022.10.31
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1661872987712/work
rich @ file:///home/conda/feedstock_root/build_artifacts/rich_1673044615039/work
ruamel.yaml @ file:///Users/runner/miniforge3/conda-bld/ruamel.yaml_1666827345171/work
ruamel.yaml.clib @ file:///Users/runner/miniforge3/conda-bld/ruamel.yaml.clib_1670412837369/work
scipy==1.10.0
setproctitle==1.3.2
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
sniffio @ file:///home/conda/feedstock_root/build_artifacts/sniffio_1662051266223/work
soupsieve @ file:///home/conda/feedstock_root/build_artifacts/soupsieve_1658207591808/work
tokenizers==0.12.1
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1657485559105/work
torch==1.13.1
torchaudio==0.13.1
torchvision==0.14.1
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1662214488106/work
transformers==4.22.1
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1665144421445/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1673452138552/work
waitress==2.1.2
watchgod @ file:///home/conda/feedstock_root/build_artifacts/watchgod_1648824610833/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1600965781394/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1669453021653/work
zstandard==0.19.0
Binary file added src/__pycache__/authtoken.cpython-311.pyc
Binary file not shown.
Binary file added src/__pycache__/authtoken.cpython-39.pyc
Binary file not shown.
50 changes: 50 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os
import tkinter as tk
import customtkinter as ctk
from PIL import ImageTk
from authtoken import auth_token
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler

# Create the app
app = tk.Tk()
app.geometry("532x632")
app.title("ezStableDiffusion")
ctk.set_appearance_mode("dark")

prompt = ctk.CTkEntry(app, height = 40, width = 512, font = ('Arial', 20), text_color="black", fg_color="white")
prompt.place(x=10, y=10)

lmain = ctk.CTkLabel(app, height=512, width=512)
lmain.place(x=10, y=110)

lms = LMSDiscreteScheduler(
beta_start=0.00085,
beta_end=0.012,
beta_schedule="scaled_linear"
)

modelid = "CompVis/stable-diffusion-v1-4"
device = "cpu"
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
scheduler=lms,
use_auth_token=auth_token,
from_tf=True,
cache_dir=os.getenv("cache_dir", "./models")
).to(device)

def generate():
with autocast(device):
image = pipe(prompt.get(), guidance_scale=9)["sample"][0]
image.save('generated.png')
img = ImageTk.PhotoImage(image)
lmain.configure(image=img)


trigger = ctk.CTkButton(app, height = 40, width = 120, font = ('Arial', 20), text_color="white", fg_color="blue", command=generate)
trigger.configure(text="Generate")
trigger.place(x=206, y=60)

app.mainloop()
4 changes: 4 additions & 0 deletions src/authtoken.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

auth_token = "HUGGINGFACE_AUTH_TOKEN"


0 comments on commit 29f7daa

Please sign in to comment.