Skip to content

Commit

Permalink
fix python 3.8 typing
Browse files Browse the repository at this point in the history
  • Loading branch information
larme committed Jan 31, 2024
1 parent c6283a2 commit e8f04e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from __future__ import annotations

import typing as t

import bentoml
from PIL.Image import Image

Expand All @@ -19,7 +23,7 @@ def __init__(self) -> None:
print("Model blip loaded", "device:", self.device)

@bentoml.api
async def generate(self, img: Image, txt: str| None = None) -> str:
async def generate(self, img: Image, txt: t.Optional[str] = None) -> str:
if txt:
inputs = self.processor(img, txt, return_tensors="pt").to(self.device)
else:
Expand Down

0 comments on commit e8f04e2

Please sign in to comment.