jsup.GEN - working on image-to-image generation with AI

Image
by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/jsup-gen-working-on-image-to-image-generation-with-ai Hello, this is @joviansummer(witness: @jswit). I'd like to share what I'm working on regarding my experintal jsup.GEN project, which tries to connect image generation AI with Steemit. Currently, jsup.GEN provide function to generate image from test prompt(txt2img). This function is interesting, but it's not easy to generate exactly what you want because you need to explain the image in detail with multiple keywords in English. Thus, I think it's more useful to have a function to generate image from existing reference image. I'm working on this image-to-image function, and thinking about two methods to implement it. The first method is to provide 2 commands as follows: !gen_t : This command focuses more on text prompt than reference image. The result may be quite different from reference because text prompt will have much more in...

파이썬 관련 메모 2가지(일시정지, 하위 디렉토리 검색)

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/2


개발 작업 참고용으로 2가지 사항을 메모해 둡니다.

파이썬에서 코드 실행을 일정 시간 동안 정지하고 싶을 경우 time.sleep()을 사용합니다. 얼마 동안 정지할 것인지라 초로 지정할 수 있습니다.

import time

# 30초간 정지
time.sleep(30)

현재 디렉토리 하위에 있는 디렉토리와 파일을 검색하려면 os.walk()를 사용합니다. 경로(path), 해당 경로에 있는 디렉토리들, 해당 경로에 있는 파일들을 생성해줍니다. 디렉토리들과 파일들이 리스트(list) 형식으로 생성됩니다.

import os

# 현재 디렉토리를 파악하여 CUR_DIR에 할당
CUR_DIR = os.getcwd()

# 현재 디렉토리 하위에 있는 디렉토리와 파일 출력
for (path, dirs, files) in os.walk(CUR_DIR):
  print("경로: ", path)
  print("디렉토리: ", dirs)
  print("파일: ", files)
  print(" ")

만약 파일명만 골라서 하나씩 출력하려면 아래와 같이 할 수 있겠습니다.

for (path, dirs, files) in os.walk(CUR_DIR):
  for file in files:
    print("파일: ", file)

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기

jsup/avle code update - you don't have to write post everyday