0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DeepIE3D 環境構築

Posted at

#やること
https://github.com/ukuleleplayer/DeepIE3D
にあるDeepIE3Dの環境構築をしていきます。

開発者のgithubだと
Frontend

webdev build--output web:build

Backend

gcloud app deploy

となっていますが、これらはrelease用のコマンドであるため、開発時には不適です。
#環境
macOS Catalina 10.15.4
Python 3.7.4
Dart VM version: 2.6.0
webdev 2.5.6
pip 19.0.3

(dart sdkをdowngradeする方法に関してはこちら
https://qiita.com/sk161717/items/d44fed3464bc7c9f0d6b)
#方法
https://github.com/ukuleleplayer/DeepIE3D
をローカルにクローンしてきます。
##Frontend
ローカルのDeepIE3D_Frontendフォルダで

webdev serve --auto=restart --launch-in-chrome --debug

を実行。localhost:8080でフロントにアクセスできるようになる。
##Backend
ローカルの/DeepIE3D/DeepIE3D_Backendにあるmain.pyを変更する。

main.py
@APP.after_request
def add_cors(response):
    '''
    Add CORS header(s) to every response from valid sites

    Allow:
    - Origin from everywhere
    - Content-Type to be shown in headers
    - GET, POST and OPTIONS methos
    '''
    #r = request.referrer[:-1]
    #if r in ['http://localhost:8080', 'localhost:8080', 'https://localhost:8080',
    #         'https://adrianwesth.dk', 'https://www.adrianwesth.dk']:
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers',
                            'Content-Type,Authorization')
    response.headers.add('Access-Control-Allow-Methods',
                            'GET,POST,OPTIONS')

    return response

変更箇所:真ん中の3行をコメントアウト。

python main.py

でlocalhost:5000にBackendが立つ。

##実行

http://127.0.0.1:8080/

にアクセスすれば初期化終了次第自由に動かせるはずです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?