Skip to content

Use File instead of Image #18

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

Merged
merged 2 commits into from
Oct 16, 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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ lint:
.PHONY: test
test:
pytest

.PHONY: lock
lock:
poetry lock --no-update
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "workflowai"
version = "0.3.2"
version = "0.3.3"
description = ""
authors = ["Guillaume Aquilina <[email protected]>"]
readme = "README.md"
Expand Down
11 changes: 3 additions & 8 deletions workflowai/core/fields/image.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from pydantic import BaseModel, Field
from workflowai.core.fields.file import File


class Image(BaseModel):
name: str = Field(..., description="An optional name for the image")
content_type: str = Field(..., description="The content type of the image", examples=["image/png", "image/jpeg"])
data: str = Field(..., description="The base64 encoded data of the image")

def to_url(self) -> str:
return f"data:{self.content_type};base64,{self.data}"
class Image(File):
pass
Loading