Ara*_*n S 10 python tensorflow jupyter-notebook google-colaboratory
我正在尝试使用 Google Colab 中的 Tensorflow 实现 Tacotron 语音合成,使用此代码在 Github 中形成一个repo,下面是我的代码并且运行良好,直到使用 localhost 服务器的步骤,我如何在 Google 的笔记本中运行 localhost 服务器科拉布?
我的代码:
!pip install tensorflow==1.3.0
import tensorflow as tf
print("You are using Tensorflow",tf.__version__)
!git clone https://github.com/keithito/tacotron.git
cd tacotron
pip install -r requirements.txt
!curl https://data.keithito.com/data/speech/tacotron-20180906.tar.gz | tar xzC /tmp
!python demo_server.py --checkpoint /tmp/tacotron-20180906/model.ckpt #requires localhost
Run Code Online (Sandbox Code Playgroud)
不幸的是,从 Google Colab 以本地模式运行对我没有帮助,因为要做到这一点,我需要在我的机器中下载太大的数据。
下面是我的最后一个输出,在这里我应该打开localhost:8888来完成工作,所以正如我之前提到的,有没有办法在 Google Colaboratory 中运行 localhost?
您可以使用诸如 ngrok 或 remote.it 之类的工具来执行此操作
他们为您提供了一个 URL,您可以从任何浏览器访问该 URL 以访问运行在 8888 上的 Web 服务器
示例 1:运行的隧道张量板
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
get_ipython().system_raw('tensorboard --logdir /content/trainingdata/objectdetection/ckpt_output/trainingImatges/ --host 0.0.0.0 --port 6006 &')
get_ipython().system_raw('./ngrok http 6006 &')
! curl -s http://localhost:4040/api/tunnels | python3 -c \
"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"
Run Code Online (Sandbox Code Playgroud)
在 colab 上运行这个安装 ngrok,并创建一个类似http://c11e1b53.ngrok.io/的链接
使用 ngrok 运行可公开访问的服务器的另一种方法:
!pip install pyngrok --quiet
from pyngrok import ngrok
# Terminate open tunnels if exist
ngrok.kill()
# Setting the authtoken (optional)
# Get your authtoken from https://dashboard.ngrok.com/auth
NGROK_AUTH_TOKEN = ""
ngrok.set_auth_token(NGROK_AUTH_TOKEN)
# Open an HTTPs tunnel on port 5000 for http://localhost:5000
public_url = ngrok.connect(port="5000", proto="http", options={"bind_tls": True})
print("Tracking URL:", public_url)
Run Code Online (Sandbox Code Playgroud)
您可以使用 localtunnel 将端口公开到公共互联网。
安装本地频道:
!npm install -g localtunnel
Run Code Online (Sandbox Code Playgroud)
启动本地隧道:
!lt --port 8888
Run Code Online (Sandbox Code Playgroud)
导航到它返回的 URL 以访问您的 Web UI。
| 归档时间: |
|
| 查看次数: |
7732 次 |
| 最近记录: |