IT 지식 창고
-
(gemini) gemini API OpenAI SDK 호환 가능IT 지식 창고 2025. 5. 6. 16:50
gemini API를 OpenAI SDK를 통해 활용 가능documentation : https://ai.google.dev/gemini-api/docs/openai?hl=ko from openai import OpenAIdef _request_google(messages, model: str): client = OpenAI( api_key=os.getenv("GOOGLE_API_KEY"), base_url="https://generativelanguage.googleapis.com/v1beta/openai/", ) return client.chat.completions.create(model=model, messages=messages)def request_g..
-
(메신저봇R) GPT(OpenAI), Gemini(Google) API 호출 코드IT 지식 창고 2025. 5. 4. 12:37
메신저봇R을 통해서 개인적인 AI봇을 만들 때, 사용한 API 호출 코드입니다.공통const scriptName = "AI봇";/** * (string) room * (string) sender * (boolean) isGroupChat * (void) replier.reply(message) * (boolean) replier.reply(room, message, hideErrorToast = false) // 전송 성공시 true, 실패시 false 반환 * (string) imageDB.getProfileBase64() * (string) packageName */function response(room, msg, sender, isGroupChat, replier, imageDB, packageN..
-
(Hibernate) SQLite Dialect ErrorIT 지식 창고 2024. 8. 24. 09:25
Hibernate 6.x 미만 버전에서는 공식적으로 SQLite dialect를 지원하지 않습니다.단, github에서 미만 버전에서 사용할 수 있도록 오픈소스형태로 공개한 repository가 있습니다. Hibernate 3:https://github.com/kemitix/sqlite-dialect net.kemitix sqlite-dialect 0.1.0Hibernate configuration:hibernate.dialect = org.hibernate.dialect.SQLiteDialectHibernate 4:https://github.com/EnigmaBridge/hibernate4-sqlite-dialect com.enigmabridge hibernate4-sqlit..
-
(torchio) 3D Data Augmentation 중 주로 사용하는 기법IT 지식 창고 2024. 5. 14. 19:18
import torchio as tio# img_size (D, H, W)def augmentation(split_set, img_size=None): aug_img_shape = [img_size[2], img_size[1], img_size[0]] if split_set == "train": aug = tio.Compose( [ #### Preprocessing # tio.CropOrPad((64,64,48)), # tio.Resample(4), # 반올림문제로 img와 mask를 subject로 resize 차이가 생길 수 있음. ..
-
(Git) 이전 Commit에서 특정 file만 삭제하기 (filter-repo)IT 지식 창고 2024. 3. 22. 19:26
FILE_NAME에 git repository를 root로 생각하고 경로를 포함하여 file 명을 넣습니다. git filter-repo --invert-paths --path FILE_NAME 본문 간혹 대용량 파일 및 개인정보를 commit하고 master에 까지 올리는 아주 큰 불상사(회사에서 그러면 안됩니다.)가 발생하였을 때, filter-repo 또는 BFG를 활용하여 삭제할 수 있다고 합니다. (문제의 commit 전까지 돌아간 다음에 그 이후의 수정 내역을 직접 반영해도 되지만 협업중에는 상당히 번거롭죠.) 완벽히 테스트 해보진 못했지만, 두 과정의 삽질한 내용을 작성해두겠습니다. git filter-repo 23년 blog를 참고해서 하다가, 그 새 조금 바뀐 것같아서 공식홈페이지 보고 ..
-
(Python) os.path vs pathlib.PathIT 지식 창고 2024. 2. 26. 22:25
저는 아래의 이유로 pathlib.Path를 더 선호합니다. 가독성 향상 os에 따른 경로 설정 (windows : WindowsPath, linux : PosixPath를 os에 따라서 알아서 설정하여 각 os별로 처리하는 방법이 다를 때 유용) Object Oriented Programming Trend (pytorch, yolo 등 활발하게 개발되는 곳에선 Path를 사용) etc… Python으로 개발 시, os.path를 활용하여 경로를 주로 다룰 수 있으나, python 3.4부터 pathlib이라는 경로 관련 객체 지향 python library가 추가되었습니다. 예제 os.path와는 어떻게 다른지 제가 자주사용하는 기능 위주로 정리해보고자 합니다. python pathlib officia..
-
(Python) 간단한 커스텀 프로그레스 바 코드IT 지식 창고 2024. 2. 21. 23:10
가끔 tqdm을 사용함에 있어 번거로움이 있을 때, 간단한 프로그레스 바를 사용할 수 있는 코드를 공유합니다. 파이썬 입문자분들은 프로그레스 바의 원리도 공부하실 수 있을 겁니다. 코드 import sys import time class ProgBar: def __init__(self, total, decimals=2, bar_length=30, interval=0.05): self.total = total self.decimals = decimals self.bar_length = bar_length self.interval = interval self._num = 0 self._last_update = 0 def start(self): self._num += 1 finalize = self._num ..