mirror of https://github.com/signalnine/lofi-imgen
initial prompt code, tweet and upscale
parent
732453471c
commit
123a010c0f
@ -0,0 +1,23 @@
|
||||
import tracery
|
||||
from tracery.modifiers import base_english
|
||||
|
||||
rules = {
|
||||
'prompt': '#setting#, #modifiers#, #modifiers#, #modifiers#',
|
||||
'setting': ['#cosy#', '#place#', '#countryside#', '#train#', '#cityscene#'],
|
||||
'cosy': ['cosy scene #time#', 'a hot cup of tea, #weather# outside', 'looking out the window at #city# #time#'],
|
||||
'countryside': ['#country# #time#', '#weather# #country# #time#', '#country#'],
|
||||
'train': ['#transit# #time#', '#weather# #transit# #time#'],
|
||||
'transit': ['train station', 'an old bus stop', 'rail station', 'subway station'],
|
||||
'time': ['at night', 'at sunrise', 'at dusk', 'at midnight', 'midday'],
|
||||
'weather': ['rainy', 'cloudy', 'foggy', 'clear', 'overcast'],
|
||||
'city': ['Tokyo', 'Sydney', 'Paris', 'Kyoto', 'Chicago', 'New York', 'San Francisco', 'Reykjavik', 'Hanoi', 'Hong Kong', 'London', 'Madrid', 'Barcelona', 'Prague', 'Santa Fe', 'Portland', 'New Orleans'],
|
||||
'cityscene': ['#place# in #city# #time#', '#weather# #place# in #city#', '#place# #time#'],
|
||||
'place': ['art museum', 'old diner', 'fancy restaurant', 'abandoned storefront', 'alleyway', 'dive bar', 'post office', 'cosy cabin', 'hotel', 'covered bridge', 'waterfront', 'pier', 'street scene'],
|
||||
'country': ['lakeside dock', 'deep in the woods', 'hillside', 'deer trail', 'hiking trail', 'mountain overlook', 'mountain pass', 'riverbank', 'forest glen', 'meadow'],
|
||||
'modifiers': ['detailed', 'trending on artstation', '4k', 'highly realistic', 'fantasy vivid colors', 'ghibli inspired', 'studio ghibli', 'anime', 'anime art style', 'anime concept art', 'vivid colors', 'bokeh', 'aesthetic', 'trending on cgsociety', 'cinematic',]
|
||||
}
|
||||
|
||||
grammar = tracery.Grammar(rules)
|
||||
grammar.add_modifiers(base_english)
|
||||
|
||||
print(grammar.flatten("#prompt#"))
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import tweepy
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
import sys
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Authenticate to Twitter
|
||||
auth = tweepy.OAuthHandler(os.getenv("APIKEY"), os.getenv("APISECRET"))
|
||||
auth.set_access_token(os.getenv("TOKEN"), os.getenv("TOKENSECRET"))
|
||||
|
||||
# Create API object
|
||||
api = tweepy.API(auth)
|
||||
|
||||
# Create a tweet
|
||||
media = api.media_upload(sys.argv[1])
|
||||
|
||||
tweet = ""
|
||||
api.update_status(status=tweet, media_ids=[media.media_id])
|
||||
|
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONTAINER=$(/snap/bin/docker ps | grep miniconda | awk '{print $1}')
|
||||
/snap/bin/docker exec -i $CONTAINER /sd/run.sh
|
||||
IMAGE="$(ls /home/gabe/stable-diffusion/outputs/*.png -t | head -n1)"
|
||||
/home/gabe/realesrgan/realesrgan-ncnn-vulkan -i "$IMAGE" -o /tmp/upscaled.png
|
||||
python3 /home/gabe/lofi-imgen/tweet.py /tmp/upscaled.png
|
Loading…
Reference in New Issue