Skip to content

update usage with flask > 2.0 #32

Description

@Vitozhu04

To ensure the usage with flask > 2.0 and flask restful > 0.3.6:
Just simply change two places:
1.Change the requirements.txt, delete version for flask, flask-restful and future
Flask
Flask-RESTful
gensim==3.6.0
future

2.Add & update word2vec-api.py
Wherever you use parser.add_argument, you may add location=['args'] to the params
For example:
Previous: parser.add_argument('w1', type=str, required=True, help="Word 1 cannot be blank!")
After: parser.add_argument('w1', type=str, required=True, help="Word 1 cannot be blank!", location=['args'])
image

(Optional) if you want to request your api through front-end, just simply add "cors = CORS(app)" after "app = Flask(name)"
image

Hope it would be helpful~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions