gradio/examples/Simple Sentence Capitalization (Textbox Input and Output).ipynb
Abubakar Abid 57f517192c 0.1.8
2019-02-22 20:25:31 -08:00

3.7 KiB

In [1]:
!pip install gradio
Collecting gradio
  Downloading https://files.pythonhosted.org/packages/3a/ca/62d769859ce82ff93bc1f8c01002a912e0e55ddaf702a880a9f30aaf9303/gradio-0.1.7-py3-none-any.whl (725kB)
Requirement already satisfied: psutil in c:\users\islam\anaconda3\lib\site-packages (from gradio) (5.4.7)
Requirement already satisfied: requests in c:\users\islam\anaconda3\lib\site-packages (from gradio) (2.19.1)
Requirement already satisfied: Pillow in c:\users\islam\anaconda3\lib\site-packages (from gradio) (5.2.0)
Requirement already satisfied: nest-asyncio in c:\users\islam\anaconda3\lib\site-packages (from gradio) (0.9.10)
Requirement already satisfied: websockets in c:\users\islam\anaconda3\lib\site-packages (from gradio) (7.0)
Requirement already satisfied: numpy in c:\users\islam\anaconda3\lib\site-packages (from gradio) (1.15.1)
Requirement already satisfied: beautifulsoup4 in c:\users\islam\anaconda3\lib\site-packages (from gradio) (4.6.3)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:\users\islam\anaconda3\lib\site-packages (from requests->gradio) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\islam\anaconda3\lib\site-packages (from requests->gradio) (2018.8.24)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\islam\anaconda3\lib\site-packages (from requests->gradio) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in c:\users\islam\anaconda3\lib\site-packages (from requests->gradio) (2.7)
Installing collected packages: gradio
Successfully installed gradio-0.1.7
You are using pip version 18.1, however version 19.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
In [2]:
import gradio
In [3]:
def capitalize_each_word(s):
    return " ".join(w.capitalize() for w in s.split())
In [4]:
iface = gradio.Interface(input="textbox", output="textbox", model=capitalize_each_word, model_type='func')
In [5]:
iface.launch()
NOTE: Gradio is in beta stage, please report all bugs to: a12d@stanford.edu
Model available locally at: http://localhost:7860/interface.html
Model available publicly for 8 hours at: http://aed68955.ngrok.io/interface.html