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

feat(toolkit): input types #380

Merged
merged 5 commits into from
Jan 21, 2025
Merged

feat(toolkit): input types #380

merged 5 commits into from
Jan 21, 2025

Conversation

badayvedat
Copy link
Contributor

@badayvedat badayvedat commented Jan 9, 2025

Proposed Interface

import os
from pydantic import BaseModel


from fal.toolkit.types import FileInput, ImageInput

class Input(BaseModel):
    image: ImageInput
    file: FileInput

a = Input(
    image="https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg",
    file="https://raw.githubusercontent.com/fal-ai/fal/refs/heads/main/README.md"
)

with a.image.as_temp_file() as file_path:
    # Path("/tmp/...")
    print(file_path)

pil_image = a.image.to_pil()
print(pil_image)

with a.file.as_temp_file() as file_path:
    # Path("/tmp/...")
    print(file_path)

@efiop efiop force-pushed the vedat/input-types branch 3 times, most recently from 24f88d4 to ebdae0e Compare January 12, 2025 12:55
@badayvedat badayvedat marked this pull request as ready for review January 14, 2025 14:46
@efiop
Copy link
Contributor

efiop commented Jan 20, 2025

Something started hanging in 3.12 specifically, likely not caused by this PR. I'm investigating.

@efiop
Copy link
Contributor

efiop commented Jan 21, 2025

It was hanging due to deprecated pkg_resources 8d992f1 , rebasing

@efiop efiop force-pushed the vedat/input-types branch from 1780be8 to 1e3d2dd Compare January 21, 2025 13:52
@efiop efiop merged commit 72a7376 into main Jan 21, 2025
10 checks passed
@efiop efiop deleted the vedat/input-types branch January 21, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants