Skip to content
Open
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: 3 additions & 1 deletion src/stability_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import time
import mimetypes
import magic

import grpc
from argparse import ArgumentParser, Namespace
Expand Down Expand Up @@ -86,7 +87,8 @@ def process_artifacts_from_answers(
for artifact in resp.artifacts:
artifact_start = time.time()
if artifact.type == generation.ARTIFACT_IMAGE:
ext = mimetypes.guess_extension(artifact.mime)
mime_type = magic.from_buffer(artifact.binary, mime=True)
ext = mime_type.split("/")[1]
contents = artifact.binary
elif artifact.type == generation.ARTIFACT_CLASSIFICATIONS:
ext = ".pb.json"
Expand Down