Skip to content

Adds multistep blocks to docs #1880

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

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion gradio/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def update(name):
btn.click(fn=update, inputs=inp, outputs=out)

demo.launch()
Demos: blocks_hello, blocks_flipper, blocks_speech_text_length, generate_english_german
Demos: blocks_hello, blocks_flipper, blocks_speech_text_sentiment, generate_english_german
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me but I actually can't run this demo locally?

I get

 raise ValueError("We expect a numpy ndarray as input")

Had to do

asr(speech[1].astype(float))

Copy link
Member Author

@abidlabs abidlabs Jul 25, 2022

Choose a reason for hiding this comment

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

I'm confused by this -- speech should be a filepath. What does speech[1].astype(float) mean here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also tested on Spaces, and the code is running fine as it was written originally: https://huggingface.co/spaces/abidlabs/asr-test-pt

Is there something different on your local version of the demo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@abidlabs could be a difference in my transformers version.

I can’t check cause I’m at the airport now. Feel free to merge, as long as the demo works on the website were good!

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, safe travels!

"""

def __init__(
Expand Down
5 changes: 5 additions & 0 deletions guides/3)building_with_blocks/1)blocks_and_event_listeners.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ $demo_reversible_flow

Note that `num1` can act as input to `num2`, and also vice-versa! As your apps get more complex, you will have many data flows connecting various Components.

Here's an example of a "multi-step" demo, where the output of one model (a speech-to-text model) gets fed into the next model (a sentiment classifier).

$code_blocks_speech_text_sentiment
$demo_blocks_speech_text_sentiment

## Function Return List vs Dict

So far, you have seen event listener functions with multiple outputs return a single value for each output component, in the order listed by the event listener. For example:
Expand Down