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...

파이썬에서 파일 확장자 분리

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


파이썬에서 간단하게 파일명에서 확장자만 따로 떼어내서 확인할 수 있습니다. os 모듈을 import하고 os.path.splitext() 함수를 사용하면 됩니다.

import os

filename = "/test/my_data.tmp.txt"
result = os.path.splitext(filename)
print(result)

('/test/my_data.tmp', '.txt')

확장자와 나머지 부분을 분리해서 위와 같이 투플(tuple)을 만들어 줍니다. 투플은 리스트(list)와 비슷하지만 값을 변경할 수 없다는 점이 다릅니다. 리스트와 마찬가지로 인덱스로 필요한 부분을 가져와서 쓰면 됩니다.

print(result[0])

/test/my_data.tmp

print(result[1])

.txt

파일의 확장자에 따라 뭔가 다른 작업을 해야 할 때 편리합니다.

``` ext_str = os.plath.splitext(filename)[1] if ext_str == ".txt": print("확장자가 .txt입니다.")

Comments

Popular posts from this blog

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

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

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