Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update usage with flask > 2.0 #32

Open
Vitozhu04 opened this issue Oct 24, 2022 · 1 comment
Open

update usage with flask > 2.0 #32

Vitozhu04 opened this issue Oct 24, 2022 · 1 comment

Comments

@Vitozhu04
Copy link

Vitozhu04 commented Oct 24, 2022

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~

@Vitozhu04 Vitozhu04 changed the title update usage with flask update usage with flask > 2.0 Oct 24, 2022
@Miikegill
Copy link

This saved me a lot of time, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants