Skip to content

Blocks page load#963

Merged
omerXfaruq merged 2 commits into
blocks-devfrom
blocks-page-load
Apr 8, 2022
Merged

Blocks page load#963
omerXfaruq merged 2 commits into
blocks-devfrom
blocks-page-load

Conversation

@omerXfaruq
Copy link
Copy Markdown
Contributor

@omerXfaruq omerXfaruq commented Apr 8, 2022

Backend part of #651

@omerXfaruq omerXfaruq requested review from abidlabs and aliabid94 April 8, 2022 13:20
@omerXfaruq omerXfaruq changed the base branch from main to blocks-dev April 8, 2022 13:20
@omerXfaruq
Copy link
Copy Markdown
Contributor Author

LoL, not sure why it authored Abubakar and me inside the commit :D

Comment thread test/test_blocks.py Outdated
ct_model, inputs=[disease, ct_scan], outputs=ct_results
)
textbox = gr.components.Textbox()
demo.load(lambda x: x, [], [textbox])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example doesn't make sense to me. The lambda function takes in an input but none is provided. Can we replace with a function that doesn't take in any inputs for it to make more sense. For example:

from datetime import datetime

def get_time():
  now = datetime.now()
  return now.strftime("%H:%M:%S")

demo.load(get_time, [], [textbox])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I actually did that, but later I thought no need for a function definition, but you are right :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw it was just a test to check the config, not a demo, but updating now.

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

Besides my comment on the example, everything else looks good.

But to clarify, this only implements the backend for #651, right? We still need to implement the frontend?

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

cc @pngwn

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Blocks] Support functions that run on page load and functions that don't have an output

2 participants