edit: ict센터입고세팅을 기본값으로 설정, ict 설정시 sftp비활성화, l14_336 사용 못하던것 수정
This commit is contained in:
@@ -103,12 +103,12 @@ class FEMUsageInfo(Enum):
|
||||
token=HUGGINGFACE_TOKEN,
|
||||
index_type=INDEX_TYPE_COSINE)]
|
||||
|
||||
openaiclip_vit_b14_336_l2 = [FEOpenAIClipViT, FEM.FEMArguments(
|
||||
openaiclip_vit_l14_336_l2 = [FEOpenAIClipViT, FEM.FEMArguments(
|
||||
trained_model=os.path.join(PRETRAINED_MODEL_PATH,ViTL14_336),
|
||||
token=HUGGINGFACE_TOKEN,
|
||||
index_type=INDEX_TYPE_L2)]
|
||||
|
||||
openaiclip_vit_b14_336_cos = [FEOpenAIClipViT, FEM.FEMArguments(
|
||||
openaiclip_vit_l14_336_cos = [FEOpenAIClipViT, FEM.FEMArguments(
|
||||
trained_model=os.path.join(PRETRAINED_MODEL_PATH,ViTL14_336),
|
||||
token=HUGGINGFACE_TOKEN,
|
||||
index_type=INDEX_TYPE_COSINE)]
|
||||
|
||||
@@ -16,25 +16,30 @@ def gemini_image(prompt, folder=None):
|
||||
image_path = ''
|
||||
client = genai.Client(api_key="AIzaSyB7tu67y9gOkJkpQtvI5OAYSzUzwv9qwnE")
|
||||
|
||||
response = client.models.generate_content(
|
||||
model="gemini-2.0-flash-preview-image-generation",
|
||||
contents=prompt,
|
||||
config=types.GenerateContentConfig(
|
||||
response_modalities=['TEXT', 'IMAGE']
|
||||
for i in range(3):
|
||||
response = client.models.generate_content(
|
||||
model="gemini-2.0-flash-preview-image-generation",
|
||||
contents=prompt,
|
||||
config=types.GenerateContentConfig(
|
||||
response_modalities=['TEXT', 'IMAGE']
|
||||
)
|
||||
)
|
||||
)
|
||||
if folder == None:
|
||||
folder = TEMP_FOLDER
|
||||
if folder == None:
|
||||
folder = TEMP_FOLDER
|
||||
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
|
||||
for part in response.candidates[0].content.parts:
|
||||
if part.inline_data is not None:
|
||||
image = Image.open(BytesIO((part.inline_data.data)))
|
||||
image_path = os.path.join(folder,f"gemini_{D.date_file_name()}_query.png")
|
||||
image.save(image_path)
|
||||
|
||||
LOG.info(f"image generate : {image_path}")
|
||||
time.sleep(2)
|
||||
|
||||
if os.path.exists(image_path):
|
||||
return image_path
|
||||
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
|
||||
for part in response.candidates[0].content.parts:
|
||||
if part.inline_data is not None:
|
||||
image = Image.open(BytesIO((part.inline_data.data)))
|
||||
image_path = os.path.join(folder,f"gemini_{D.date_file_name()}_query.png")
|
||||
image.save(image_path)
|
||||
|
||||
LOG.info(f"image generate : {image_path}")
|
||||
time.sleep(2)
|
||||
return image_path
|
||||
Reference in New Issue
Block a user