Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

huemin fix #47

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions logos/creation_interfaces/kojii_huemin.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ def generate_prompt(selected_climate, selected_landform, selected_body_of_water)
selected_structure = (
random.choice(list(Structure)).value if random.random() < 0.20 else ""
)
selected_season = random.choice(list(Season)).value if random() < 0.95 else ""
selected_season = (
random.choice(list(Season)).value if random.random() < 0.95 else ""
)
# selected_time_of_day = random.choice(list(TimeOfDay)).value
selected_colors = random.choice(list(Color)).value if random() < 0.95 else ""
selected_colors = random.choice(list(Color)).value if random.random() < 0.95 else ""

selected_keywords = [
selected_climate.value,
Expand Down Expand Up @@ -212,21 +214,3 @@ def kojii_huemin(request: KojiiHueminRequest, callback=None):
image_url, thumbnail_url = replicate.sdxl(config)

return image_url, thumbnail_url


def kojii_huemin(request: KojiiHueminRequest, callback=None):
print("HUMIN REQUEST")
print(request)
prompt = generate_prompt(request.climate, request.landform, request.body_of_water)
seed = request.seed if request.seed else random.randint(0, 1000000)
print(prompt)

config = {
"mode": "kojii/huemin",
"text_input": prompt,
"seed": seed,
}

image_url, thumbnail_url = replicate.sdxl(config)

return image_url, thumbnail_url
25 changes: 25 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from logos.llm import LLM
from pydantic import BaseModel


class OutputSchema(BaseModel):
"""
Output schema for LLM
"""

description: str
numimages: int


llm = LLM(model="gpt-4-1106-preview", system_message="You are an AI assistant")

prompt = "Describe this image. In description, tell me what the image is about. In numimages, tell me how many images are attached."

result = llm(
prompt,
image="https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/27d5f97d76bb6550cec0f82296587bbc1ac1d66d34cfa824f3056046abe8c0e1.jpg",
output_schema=OutputSchema,
params={"max_tokens": 1000},
)

print(result)
Loading