Skip to content

How can a file be used instead of a url in the header image? #2190

Answered by mturoci
gbethardy-h2oai asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gbethardy-h2oai.

You can also manually upload the image to the server and use that:

from h2o_wave import Q, ui, main, app


@app('/')
async def serve(q: Q):
    q.app.img, = await q.site.upload(['img.png'])
    q.page['header'] = ui.header_card(
        box='1 1 -1 1',
        title='My app',
        subtitle='Let\'s get started!',
        image=q.app.img
    )
    await q.page.save()

See docs for more info.

However, a better option is to usually go for public dir option and use its URL then. See

https://wave.h2o.ai/docs/configuration/#configuring-the-server
https://wave.h2o.ai/docs/configuration/#publicprivate-dirs
https://wave.h2o.ai/docs/files/#serving-files-directly-from-the-wave-…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gbethardy-h2oai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants