This commit is contained in:
Ali Abid 2021-07-22 11:18:32 -07:00
commit 1a00d9f585
6 changed files with 16 additions and 21 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ test.txt
build/
gradio/launches.json
gradio/frontend/static
workspace.code-workspace

View File

@ -34,10 +34,11 @@ pip install gradio
import gradio as gr
def greet(name):
return "Hello " + name + "!"
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
```
<span>3.</span> The interface below will appear automatically within the Python notebook, or pop in a browser on [http://localhost:7860](http://localhost:7860/) if running from a script.
@ -130,6 +131,7 @@ import gradio as gr
import random
def calculator(num1, operation, num2):
print(num1, operation, num2)
if operation == "add":
return num1 + num2
elif operation == "subtract":
@ -148,6 +150,9 @@ iface = gr.Interface(calculator,
[-4, "multiply", 2.5],
[0, "subtract", 1.2],
],
title="test calculator",
description="heres a sample toy calculator. enjoy!",
flagging_options=["this", "or", "that"]
)
iface.launch()
@ -211,7 +216,7 @@ This generates a public, shareable link that you can send to anybody! When you s
Keep in mind, however, that these links are publicly accessible, meaning that anyone can use your model for prediction! Therefore, make sure not to expose any sensitive information through the functions you write, or allow any critical changes to occur on your device. If you set `share=False` (the default), only a local link is created, which can be shared by [port-forwarding](https://www.ssh.com/ssh/tunneling/example) with specific users.
Share links expire after 6 hours.
Share links expire after 72 hours. For permanent hosting, see below.
![Sharing diagram](demo/images/sharing.svg)

View File

@ -536,7 +536,9 @@ class Interface:
self.share = share
if share:
if not private_endpoint:
if private_endpoint:
print(strings.en["PRIVATE_LINK_MESSAGE"])
else:
print(strings.en["SHARE_LINK_MESSAGE"])
try:
share_url = networking.setup_tunnel(server_port, private_endpoint)

View File

@ -21,6 +21,7 @@ en = {
"To turn off, set debug=False in launch().",
"COLAB_DEBUG_FALSE": "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()",
"SHARE_LINK_MESSAGE": "This share link will expire in 24 hours. If you need a permanent link, visit: https://gradio.app/introducing-hosted (NEW!)",
"PRIVATE_LINK_MESSAGE": "Since this is a private endpoint, this share link will never expire.",
"SHARE_LINK_DISPLAY": "Running on External URL: {}",
"INLINE_DISPLAY_BELOW": "Interface loading below...",
"MEDIA_PERMISSIONS_IN_COLAB": "Your interface requires microphone or webcam permissions - this may cause issues in Colab. Use the External URL in case of issues.",

View File

@ -136,7 +136,7 @@ This generates a public, shareable link that you can send to anybody! When you s
Keep in mind, however, that these links are publicly accessible, meaning that anyone can use your model for prediction! Therefore, make sure not to expose any sensitive information through the functions you write, or allow any critical changes to occur on your device. If you set `share=False` (the default), only a local link is created, which can be shared by [port-forwarding](https://www.ssh.com/ssh/tunneling/example) with specific users.
Share links expire after 6 hours.
Share links expire after 72 hours. For permanent hosting, see below.
![Sharing diagram](demo/images/sharing.svg)

View File

@ -1,14 +0,0 @@
{
"folders": [
{
"path": "..\\gradio_static"
},
{
"path": "..\\gradiohub"
},
{
"path": "."
}
],
"settings": {}
}