mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-25 12:10:31 +08:00
updated demos
This commit is contained in:
parent
f817f33c24
commit
3010d55132
@ -8,9 +8,12 @@ examples = [
|
||||
["The smooth Borealis basin in the Northern Hemisphere covers 40%"],
|
||||
]
|
||||
|
||||
gr.Interface.load(
|
||||
demo = gr.Interface.load(
|
||||
"huggingface/EleutherAI/gpt-j-6B",
|
||||
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
|
||||
inputs=gr.Textbox(lines=5, label="Input Text"),
|
||||
title=title,
|
||||
examples=examples,
|
||||
).launch()
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
|
@ -7,6 +7,6 @@ def greet(name):
|
||||
return "Hello " + name + "!!"
|
||||
|
||||
|
||||
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
||||
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
||||
if __name__ == "__main__":
|
||||
iface.launch(auth=lambda u, p: user_db.get(u) == p)
|
||||
demo.launch(auth=lambda u, p: user_db.get(u) == p)
|
||||
|
@ -5,6 +5,7 @@ def greet(name):
|
||||
return "Hello " + name + "!!"
|
||||
|
||||
|
||||
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
||||
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
||||
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -5,10 +5,11 @@ def greet(name):
|
||||
return "Hello " + name + "!"
|
||||
|
||||
|
||||
iface = gr.Interface(
|
||||
demo = gr.Interface(
|
||||
fn=greet,
|
||||
inputs=gr.inputs.Textbox(lines=2, placeholder="Name Here..."),
|
||||
inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
|
||||
outputs="text",
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app, local_url, share_url = iface.launch()
|
||||
app, local_url, share_url = demo.launch()
|
||||
|
@ -8,10 +8,10 @@ def greet(name, is_morning, temperature):
|
||||
return greeting, round(celsius, 2)
|
||||
|
||||
|
||||
iface = gr.Interface(
|
||||
demo = gr.Interface(
|
||||
fn=greet,
|
||||
inputs=["text", "checkbox", gr.inputs.Slider(0, 100)],
|
||||
inputs=["text", "checkbox", gr.Slider(0, 100)],
|
||||
outputs=["text", "number"],
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
@ -17,12 +17,15 @@ def classify_image(inp):
|
||||
return {labels[i]: float(prediction[i]) for i in range(1000)}
|
||||
|
||||
|
||||
image = gr.inputs.Image(shape=(224, 224))
|
||||
label = gr.outputs.Label(num_top_classes=3)
|
||||
image = gr.Image(shape=(224, 224))
|
||||
label = gr.Label(num_top_classes=3)
|
||||
|
||||
gr.Interface(
|
||||
demo = gr.Interface(
|
||||
fn=classify_image,
|
||||
inputs=image,
|
||||
outputs=label,
|
||||
examples=[["images/cheetah1.jpg"], ["images/lion.jpg"]],
|
||||
).launch()
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
|
@ -20,6 +20,10 @@ def predict(inp):
|
||||
return {labels[i]: float(prediction[i]) for i in range(1000)}
|
||||
|
||||
|
||||
inputs = gr.inputs.Image()
|
||||
outputs = gr.outputs.Label(num_top_classes=3)
|
||||
gr.Interface(fn=predict, inputs=inputs, outputs=outputs).launch()
|
||||
inputs = gr.Image()
|
||||
outputs = gr.Label(num_top_classes=3)
|
||||
|
||||
demo = gr.Interface(fn=predict, inputs=inputs, outputs=outputs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
|
@ -17,9 +17,11 @@ def classify_image(inp):
|
||||
return {labels[i]: float(prediction[i]) for i in range(1000)}
|
||||
|
||||
|
||||
image = gr.inputs.Image(shape=(224, 224))
|
||||
label = gr.outputs.Label(num_top_classes=3)
|
||||
image = gr.Image(shape=(224, 224))
|
||||
label = gr.Label(num_top_classes=3)
|
||||
|
||||
gr.Interface(
|
||||
fn=classify_image, inputs=image, outputs=label, interpretation="default"
|
||||
).launch()
|
||||
demo = gr.Interface(fn=classify_image, inputs=image, outputs=label,
|
||||
interpretation="default")
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
@ -5,6 +5,7 @@ def image_mod(image):
|
||||
return image.rotate(45)
|
||||
|
||||
|
||||
iface = gr.Interface(image_mod, gr.inputs.Image(type="pil"), "image")
|
||||
demo = gr.Interface(image_mod, gr.inputs.Image(type="pil"), "image")
|
||||
|
||||
if __name__ == "__main__":
|
||||
iface.launch()
|
||||
demo.launch()
|
||||
|
Loading…
x
Reference in New Issue
Block a user