summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdmin <admin@pleiades.link>2022-09-04 01:14:51 +0200
committerAdmin <admin@pleiades.link>2022-09-04 01:14:51 +0200
commit0888d46e734d2bf5ab9e26176d2c3ec9bbd4e36f (patch)
tree6dbccc218b20638bdda17db68c875bf9ee87a173
downloadAlienLandscapes-0888d46e734d2bf5ab9e26176d2c3ec9bbd4e36f.tar.bz2
AlienLandscapes-0888d46e734d2bf5ab9e26176d2c3ec9bbd4e36f.zip
1.0
-rw-r--r--.gitignore71
-rw-r--r--changelog.txt2
-rw-r--r--generate.py19
-rw-r--r--login.py17
-rw-r--r--prompts.txt21
-rw-r--r--send.py28
6 files changed, 158 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..caefe1d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,71 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+*.png
+*.jpg
+
+token
+count
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+.env
+draft.txt
+history.txt
+words.txt
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+#Ipython Notebook
+.ipynb_checkpoints
+upscale.jar
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..aacdb09
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,2 @@
+1.0
+- Basic functionality \ No newline at end of file
diff --git a/generate.py b/generate.py
new file mode 100644
index 0000000..cd01953
--- /dev/null
+++ b/generate.py
@@ -0,0 +1,19 @@
+import torch
+from torch import autocast
+from diffusers import StableDiffusionPipeline
+
+model_id = "CompVis/stable-diffusion-v1-4"
+device = "cuda"
+pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
+pipe = pipe.to(device)
+
+sample_num = 5
+lst = []
+prompt = "Merkhaba"
+for i in range(sample_num):
+ with autocast("cuda"):
+ lst.append(pipe(prompt, guidance_scale = 7.5, num_inference_steps = 100 )["sample"][0])
+
+
+for i in range(sample_num):
+ lst[i].save(f'outputs/gen-image-{i}.png') \ No newline at end of file
diff --git a/login.py b/login.py
new file mode 100644
index 0000000..451d1ed
--- /dev/null
+++ b/login.py
@@ -0,0 +1,17 @@
+import os
+from pathlib import Path
+import argparse
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--token', type=str, default=None, help='Your HuggingFace token')
+ args = parser.parse_args()
+
+
+ os.mkdir('/root/.huggingface')
+
+ Path('/root/.huggingface/token').touch()
+ with open('/root/.huggingface/token', 'w') as f:
+ f.write(args.token)
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/prompts.txt b/prompts.txt
new file mode 100644
index 0000000..73a5bf5
--- /dev/null
+++ b/prompts.txt
@@ -0,0 +1,21 @@
+Alien forest with tentacles and jungle buildings
+
+Alien desert with sacred totems and a mud village distant in the mountain
+
+Alien plains with giant statues, exotic flowers and a herd of mammal alien creatures
+
+Landscape of another planet with stars, stone buildings and a ritual
+
+Landscape in Mars with a temple and evil monks praying for doom
+
+An alien temple to an evil god that sacrifices children
+
+Alien jungle with a temple with a giant statue of a sacred god and stairs and arched columns under the stars
+
+DMT landscape with the sun on top of a pyramid and a star background, and a tunnel of light that comes from space and connects the pyramid
+
+An alien DMT-inspired landscape with ethereal talking heads floating over exotic trees that form a dense jungle
+
+Futuristic metropolis with a lot of pollution, tall dark buildings and a feeling of despair in the style of John Frederick Kensett
+
+Ancient metropolis in a mysterious landscape with jungle tall buildings under the stars in the style of John Frederick Kensett \ No newline at end of file
diff --git a/send.py b/send.py
new file mode 100644
index 0000000..426ab03
--- /dev/null
+++ b/send.py
@@ -0,0 +1,28 @@
+import random, os, pathlib
+from mastodon import Mastodon
+from decouple import config
+
+#140 included
+
+# Mastodon token and domain
+mastodon = Mastodon(
+ access_token = config('token',default=''),
+ api_base_url = 'https://botsin.space/'
+)
+
+# Read counter
+f = open("count", "r")
+content = f.read()
+f.close()
+count = int(content[0])
+
+# Upload PNG file to Mastodon
+file = "final/" + str(count) + ".png"
+media = mastodon.media_post(file)
+mastodon.status_post("", media_ids=media)
+
+# Save counter
+count += 1
+f = open("count", "w")
+f.write(str(count))
+f.close() \ No newline at end of file