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

word2vec 모듈에서 json 으로 변환 불가능 한 값 반환함 #8

Open
KYUUUW opened this issue Aug 3, 2021 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@KYUUUW
Copy link
Contributor

KYUUUW commented Aug 3, 2021

Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/kyuwon/sources/flask_server/app.py", line 61, in infer_similar_word2vec
    return json.dumps(result)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/anaconda3/envs/perfume_recommendation/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable

return 하는 형식은 json.dumps()로 serialize 할 수 있는 형태로 만들어주세요~

@KYUUUW KYUUUW added the bug Something isn't working label Aug 3, 2021
@KYUUUW
Copy link
Contributor Author

KYUUUW commented Aug 4, 2021

{'name': {0: 'Fahrenheit Christian Dior for men', 1: 'Molecule 01 Escentric Molecules for women and men', 2: 'Layton Parfums de Marly for women and men'}, 'accords': {0: "['leather', 'woody', 'ozonic', 'fresh spicy', 'animalic', 'aromatic', 'aquatic', 'floral', 'citrus', 'green']", 1: "['woody', 'musky', 'amber', 'animalic']", 2: "['warm spicy', 'vanilla', 'fresh spicy', 'woody', 'aromatic', 'fruity', 'powdery', 'lavender', 'fresh', 'citrus']"}, 'similarity': {0: array([0.88679464]), 1: array([0.88224883]), 2: array([0.87916585])}, 'review': {0: 'I love Fahrenheit.  I smells so warm and lovely.......even at the end of the day.  I get a lot of compliments when I wear it at work.', 1: 'scent : 9/10\r\nsillage : 6/10\r\nlongevity :7/10\r\n60% day/ 40% night fragrance\r\nnice woody and fresh scent', 2: 'My signature scent, you can wear this during the day, at night, on a date, winter fall and spring, I even wear it in the summer except super hot days, women compliment this all the time. Great longevity.  If your looking at getting a Niche fragrance this is a safe powerhouse that also smells unique. Parfumes de Marley has blended this so well. 10/10'}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants