Git Product home page Git Product logo

dalleepaperframe's People

Contributors

famousdirector avatar palpen avatar

dalleepaperframe's Issues

Make prompts_config.yml an input when running the client.py module

Currently, prompts_config.yml is hardcoded in the client.py module. Making it an input instead will allow for different prompt configuration across different displays (e.g. some display can have a children illustration theme whereas others could be Van Gogh oil paintings)

Load images from `saved_images` when server is off---even if there are new Tweet prompts

The client checks the saved_images folder for text prompts for which images have already been generated. If there happens to be a Tweet prompt for which no images has been generated by the client and the server also happens to be off, the client will keep sending a request to the server for a new image and fail. Eventually, the counter for the number of screen refreshes reaches its max limit and the client's program is shut off.

This is a bug. We want the client to load images from the saved_images folder when the server is off (if there are no images, then the program should exit) even if there are new Tweet prompts.

Solution:

  • Only send requests for Tweet prompts to the Twitter API when the server is on, otherwise load image from saved_images

Implementation:

  • Check status of API endpoint for the server (in check_recent_tweets_and_generate_image_if_new?) before making a request to Twitter API

Add custom trigger hashtag for each client display

At present, each client is checking Twitter for a text prompt using the same hashtag. A new tweet with the trigger hashtag (currently, #dalle) will update the image in all client displays. This issue will make the changes that will assign a unique trigger hashtag to each client so that they can be controlled from Twitter independently (but also includes the option to change them all simultaneously).

Implementation:

  • Move the trigger hashtag from tweets_utils.py to the config yaml files
  • Add hashtag that will change all displays (probably just keep the default, #dalle)
  • Update retrieve_tweets_containing_text_prompt function in tweets_utils.py to include an argument for each trigger hashtag

Replace print statements with logging functions

Code for how to do this

import logging
from logging.handlers import RotatingFileHandler

LOG_LEVEL = logging.INFO

logging.basicConfig(
    handlers=[RotatingFileHandler('client.log', maxBytes=100000, backupCount=10)],
    level=LOG_LEVEL,
    format="[%(asctime)s] %(levelname)s [%(filename)s.%(module)s.%(funcName)s:%(lineno)d] %(message)s",
    datefmt='%Y-%m-%dT%H:%M:%S'
)
logger = logging.getLogger('client_logger')


# Testing
def foo():
    logger.info("Log in function")
    return None

for i in range(1000):
    foo()
    logger.info(f"This is an info {i}")
    logger.debug('Hello, world!')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.