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
Trying to make the output download an excel file or display a dataframe #29
Comments
Hey @batman984, based on your example I have created this file:
Though, when I call the
Unfortunately, this does not help with directly downloading it from the Swagger UI yet. |
Aww .. bummer .. Hope it maybe supported in the future |
@batman984 The download might actually already give you the correct file, but just the file extension is missing. Currently, the file extension is determined by the specified mime type. The official mimetype for from opyrator.components.types import FileContent
from pydantic import BaseModel, Field, validator
class Input(BaseModel):
excel_file: FileContent = Field(
...,
mime_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
class Output(BaseModel):
excel_file: FileContent = Field(
...,
mime_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
def return_file(input: Input) -> Output:
return Output(excel_file=input.excel_file.as_bytes()) |
Ah, great that works! My post was about the Swagger API (via |
That worked .. thank you so much @LukasMasuch .. closing the issue :) |
Hi,
I have been doodling with opyrator, I think it is awesome.
I got stuck in trying to make the output for the user is to download an excel file generated following the model you have in upscaling the image and spleeter example
`
class HelixPredictOutput(BaseModel):
upscaled_image_file: FileContent = Field(
...,
mime_type="application/excel",
description="excel file download",
)
def image_super_resolution(
input: HelixPredictInput,
) -> HelixPredictOutput:
`
But that gave me a weird zip file when I press on the download button that was unsupported. Is there anyway to make it download the excel file?
The text was updated successfully, but these errors were encountered: