File tree 7 files changed +44
-2
lines changed
website/homepage/src/docs
7 files changed +44
-2
lines changed Original file line number Diff line number Diff line change
1
+ import gradio as gr
2
+
3
+ greeter_1 = gr .Interface (lambda name : f"Hello { name } !" , inputs = "textbox" , outputs = gr .Textbox (label = "Greeter 1" ))
4
+ greeter_2 = gr .Interface (lambda name : f"Greetings { name } !" , inputs = "textbox" , outputs = gr .Textbox (label = "Greeter 2" ))
5
+ demo = gr .Parallel (greeter_1 , greeter_2 )
6
+
7
+ if __name__ == "__main__" :
8
+ demo .launch ()
Original file line number Diff line number Diff line change
1
+ import gradio as gr
2
+
3
+ generator1 = gr .Interface .load ("huggingface/gpt2" )
4
+ generator2 = gr .Interface .load ("huggingface/EleutherAI/gpt-neo-2.7B" )
5
+ generator3 = gr .Interface .load ("huggingface/EleutherAI/gpt-j-6B" )
6
+
7
+ demo = gr .Parallel (generator1 , generator2 , generator3 )
8
+
9
+ if __name__ == "__main__" :
10
+ demo .launch ()
Original file line number Diff line number Diff line change
1
+ import gradio as gr
2
+
3
+ get_name = gr .Interface (lambda name : name , inputs = "textbox" , outputs = "textbox" )
4
+ prepend_hello = gr .Interface (lambda name : f"Hello { name } !" , inputs = "textbox" , outputs = "textbox" )
5
+ append_nice = gr .Interface (lambda greeting : f"{ greeting } Nice to meet you!" ,
6
+ inputs = "textbox" , outputs = gr .Textbox (label = "Greeting" ))
7
+ demo = gr .Series (get_name , prepend_hello , append_nice )
8
+
9
+ if __name__ == "__main__" :
10
+ demo .launch ()
Original file line number Diff line number Diff line change
1
+ import gradio as gr
2
+
3
+ generator = gr .Interface .load ("huggingface/gpt2" )
4
+ translator = gr .Interface .load ("huggingface/t5-small" )
5
+
6
+ demo = gr .Series (generator , translator )
7
+
8
+ if __name__ == "__main__" :
9
+ demo .launch ()
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ class Parallel(gradio.Interface):
17
17
"""
18
18
Creates a new Interface consisting of multiple models in parallel (comparing their outputs).
19
19
The Interfaces to put in Parallel must share the same input components (but can have different output components).
20
+
21
+ Demos: interface_parallel, interface_parallel_load
20
22
"""
21
23
22
24
def __init__ (self , * interfaces : gradio .Interface , ** options ):
@@ -57,6 +59,8 @@ class Series(gradio.Interface):
57
59
"""
58
60
Creates a new Interface from multiple models in series (the output of one is fed as the input to the next,
59
61
and so the input and output components must agree between the interfaces).
62
+
63
+ Demos: interface_series, interface_series_load
60
64
"""
61
65
62
66
def __init__ (self , * interfaces : gradio .Interface , ** options ):
Original file line number Diff line number Diff line change 1
1
# Advanced Interface Features
2
2
3
3
Pinned: 1
4
+ Docs: series, parallel
4
5
5
6
** Prerequisite** : This Guide builds on the Quickstart. Make sure to [ read the Quickstart first] ( /getting_started ) .
6
7
Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ <h3 class="text-3xl font-light my-4" id="combining-interfaces">Combining Interfa
49
49
{% with obj=find_cls("TabbedInterface"), parent="gradio" %}
50
50
{% include "docs/obj_doc_template.html" %}
51
51
{% endwith %}
52
- {% with obj=find_cls("Parallel"), parent="gradio" %}
52
+ {% with obj=find_cls("Parallel"), is_class=True, parent="gradio" %}
53
53
{% include "docs/obj_doc_template.html" %}
54
54
{% endwith %}
55
- {% with obj=find_cls("Series"), parent="gradio" %}
55
+ {% with obj=find_cls("Series"), is_class=True, parent="gradio" %}
56
56
{% include "docs/obj_doc_template.html" %}
57
57
{% endwith %}
58
58
</ div >
You can’t perform that action at this time.
0 commit comments