Skip to content

Commit

Permalink
removed non-functioning fireworks imagegen
Browse files Browse the repository at this point in the history
  • Loading branch information
chadbailey59 committed Apr 12, 2024
1 parent f315f69 commit 3255c7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 51 deletions.
21 changes: 7 additions & 14 deletions examples/foundational/03-still-frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from dailyai.pipeline.pipeline import Pipeline
from dailyai.transports.daily_transport import DailyTransport
from dailyai.services.fal_ai_services import FalImageGenService
from dailyai.services.fireworks_ai_services import FireworksImageGenService

from runner import configure

Expand All @@ -31,20 +30,14 @@ async def main(room_url):
duration_minutes=1
)

# imagegen = FalImageGenService(
# params=FalImageGenService.InputParams(
# image_size="square_hd"
# ),
# aiohttp_session=session,
# key_id=os.getenv("FAL_KEY_ID"),
# key_secret=os.getenv("FAL_KEY_SECRET"),
# )

imagegen = FireworksImageGenService(
imagegen = FalImageGenService(
params=FalImageGenService.InputParams(
image_size="square_hd"
),
aiohttp_session=session,
api_key=os.getenv("FIREWORKS_API_KEY"),
model="accounts/fireworks/models/stable-diffusion-xl-1024-v1-0",
image_size="1024x1024")
key_id=os.getenv("FAL_KEY_ID"),
key_secret=os.getenv("FAL_KEY_SECRET"),
)

pipeline = Pipeline([imagegen])

Expand Down
37 changes: 0 additions & 37 deletions src/dailyai/services/fireworks_ai_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,6 @@ def __init__(self, model="accounts/fireworks/models/firefunction-v1", *args, **k
super().__init__(model, *args, **kwargs)


class FireworksImageGenService(ImageGenService):

def __init__(
self,
*,
image_size: Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"],
aiohttp_session: aiohttp.ClientSession,
api_key,
model="accounts/fireworks/models/stable-diffusion-xl-1024-v1-0",
):
super().__init__()
self._model = model
self._image_size = image_size
self._client = AsyncOpenAI(api_key=api_key,
base_url="https://api.fireworks.ai/inference/v1")
self._aiohttp_session = aiohttp_session

async def run_image_gen(self, prompt: str) -> tuple[str, bytes, tuple[int, int]]:
self.logger.info(f"Generating Fireworks image: {prompt}")

image = await self._client.images.generate(
prompt=prompt,
model=self._model,
n=1,
size=self._image_size
)
print(f"!!! image is {image}")
image_url = image.data[0].url
if not image_url:
raise Exception("No image provided in response", image)

# Load the image from the url
async with self._aiohttp_session.get(image_url) as response:
image_stream = io.BytesIO(await response.content.read())
image = Image.open(image_stream)
return (image_url, image.tobytes(), image.size)


class FireworksVisionService(OpenAIVisionService):
def __init__(self, *, api_key, model="accounts/fireworks/models/firellava-13b"):
Expand Down

0 comments on commit 3255c7f

Please sign in to comment.