-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update-shortcut-syntax - fix&update gr.component - create a demo introducing shortcuts within Blocks * update-shortcut-syntax - tweaks * update-shortcut-syntax - tweaks * update-shortcut-syntax - fix formatting * update-shortcut-syntax - tweaks - fix tests * update-shortcut-syntax - tweaks - fix tests * update-shortcut-syntax - tweaks - fix tests
- Loading branch information
1 parent
1c3dffd
commit 2de9ee8
Showing
8 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import gradio as gr | ||
|
||
|
||
def greet(str): | ||
return str | ||
|
||
|
||
with gr.Blocks() as demo: | ||
""" | ||
You can make use of str shortcuts you use in Interface within Blocks as well. | ||
Interface shortcut example: | ||
Interface(greet, "textarea", "textarea") | ||
You can use | ||
1. gr.component() | ||
2. gr.templates.Template() | ||
3. gr.Template() | ||
All the templates are listed in gradio/templates.py | ||
""" | ||
with gr.Row(): | ||
text1 = gr.component("textarea") | ||
text2 = gr.TextArea() | ||
text3 = gr.templates.TextArea() | ||
text1.change(greet, text1, text2) | ||
text2.change(greet, text2, text3) | ||
text3.change(greet, text3, text1) | ||
demo.launch() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters