mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-25 12:10:31 +08:00
more demos
This commit is contained in:
parent
5fa69783e9
commit
76d5a5278f
@ -7,9 +7,9 @@ def transpose(matrix):
|
||||
return matrix.T
|
||||
|
||||
|
||||
iface = gr.Interface(
|
||||
demo = gr.Interface(
|
||||
transpose,
|
||||
gr.inputs.Dataframe(type="numpy", datatype="number", row_count=5, col_count=3),
|
||||
gr.Dataframe(type="numpy", datatype="number", row_count=5, col_count=3),
|
||||
"numpy",
|
||||
examples=[
|
||||
[np.zeros((3, 3)).tolist()],
|
||||
@ -20,7 +20,5 @@ iface = gr.Interface(
|
||||
],
|
||||
)
|
||||
|
||||
iface.test_launch()
|
||||
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -27,17 +27,17 @@ def outbreak(r, month, countries, social_distancing):
|
||||
return plt
|
||||
|
||||
|
||||
iface = gr.Interface(
|
||||
demo = gr.Interface(
|
||||
outbreak,
|
||||
[
|
||||
gr.inputs.Slider(1, 4, default=3.2, label="R"),
|
||||
gr.inputs.Dropdown(
|
||||
gr.Slider(minimum=1, maximum=4, default_value=3.2, label="R"),
|
||||
gr.Dropdown(
|
||||
["January", "February", "March", "April", "May"], label="Month"
|
||||
),
|
||||
gr.inputs.CheckboxGroup(["USA", "Canada", "Mexico", "UK"], label="Countries"),
|
||||
gr.inputs.Checkbox(label="Social Distancing?"),
|
||||
gr.CheckboxGroup(["USA", "Canada", "Mexico", "UK"], label="Countries"),
|
||||
gr.Checkbox(label="Social Distancing?"),
|
||||
],
|
||||
"plot",
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -7,18 +7,21 @@ examples = [
|
||||
]
|
||||
]
|
||||
|
||||
gr.Interface.load(
|
||||
demo = gr.Interface.load(
|
||||
"huggingface/deepset/roberta-base-squad2",
|
||||
inputs=[
|
||||
gr.inputs.Textbox(
|
||||
gr.Textbox(
|
||||
lines=5, label="Context", placeholder="Type a sentence or paragraph here."
|
||||
),
|
||||
gr.inputs.Textbox(
|
||||
gr.Textbox(
|
||||
lines=2,
|
||||
label="Question",
|
||||
placeholder="Ask a question based on the context.",
|
||||
),
|
||||
],
|
||||
outputs=[gr.outputs.Textbox(label="Answer"), gr.outputs.Label(label="Probability")],
|
||||
outputs=[gr.Textbox(label="Answer"), gr.Label(label="Probability")],
|
||||
examples=examples,
|
||||
).launch()
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
|
@ -8,7 +8,7 @@ def reverse_audio(audio):
|
||||
return (sr, np.flipud(data))
|
||||
|
||||
|
||||
iface = gr.Interface(reverse_audio, "microphone", "audio", examples="audio")
|
||||
demo = gr.Interface(reverse_audio, "microphone", "audio", examples="audio")
|
||||
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -24,9 +24,9 @@ def sales_projections(employee_data):
|
||||
return employee_data, plt.gcf(), regression_values
|
||||
|
||||
|
||||
iface = gr.Interface(
|
||||
demo = gr.Interface(
|
||||
sales_projections,
|
||||
gr.inputs.Dataframe(
|
||||
gr.Dataframe(
|
||||
headers=["Name", "Jan Sales", "Feb Sales", "Mar Sales"],
|
||||
default=[["Jon", 12, 14, 18], ["Alice", 14, 17, 2], ["Sana", 8, 9.5, 12]],
|
||||
),
|
||||
@ -34,4 +34,4 @@ iface = gr.Interface(
|
||||
description="Enter sales figures for employees to predict sales trajectory over year.",
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -13,8 +13,7 @@ def sentiment_analysis(text):
|
||||
return scores
|
||||
|
||||
|
||||
iface = gr.Interface(sentiment_analysis, "textbox", "label", interpretation="default")
|
||||
demo = gr.Interface(sentiment_analysis, "textbox", "label", interpretation="default")
|
||||
|
||||
iface.test_launch()
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
Loading…
x
Reference in New Issue
Block a user