fandangOrg / fandango

FAke News discovery and propagation from big Data ANalysis and artificial intelliGence Operations
1 stars 1 forks source link

Images analysis service #84

Closed macagari closed 3 years ago

macagari commented 3 years ago

Image analysis service is not working correctly. This is the error I've got locally

iMAGE REQUEST {'url': 'https://upload.wikimedia.org/wikipedia/commons/b/b4/Meloni_Salvini_Berlusconi.jpg', 'force': True} [2020-12-03 12:15:47,049] ERROR in app: Exception on /fandango/v0.3/fakeness/url_image_score [GET] Traceback (most recent call last): File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection raise err File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.6/http/client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.6/http/client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.6/http/client.py", line 1026, in _send_output self.send(msg) File "/usr/local/lib/python3.6/http/client.py", line 964, in send self.connect() File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect conn = self._new_conn() File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fbccb24cd30>: Failed to establish a new connection: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='fcerthonline.westeurope.cloudapp.azure.com', port=5006): Max retries exceeded with url: /api/analyze_image (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbccb24cd30>: Failed to establish a new connection: [Errno 110] Connection timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function return cors_after_request(app.make_response(f(args, kwargs))) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](req.view_args) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/ds4biz_flask/utils/conversion_utils.py", line 214, in temp result=f(args,kwargs) File "/home/camila/projects/fandango-fake-news/fake_news_detection/services/ServicesFandango.py", line 150, in url_image_score response = u.post(data=j, headers=headers) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/ds4biz_commons/utils/requests_utils.py", line 55, in post resp = requests.post(self.__base,args) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, kwargs) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/home/camila/projects/fandango-fake-news/venv/lib/python3.6/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='fcerthonline.westeurope.cloudapp.azure.com', port=5006): Max retries exceeded with url: /api/analyze_image (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbccb24cd30>: Failed to establish a new connection: [Errno 110] Connection timed out',)) 127.0.0.1 - - [03/Dec/2020 12:15:47] "GET /fandango/v0.3/fakeness/url_image_score?url=https://upload.wikimedia.org/wikipedia/commons/b/b4/Meloni_Salvini_Berlusconi.jpg HTTP/1.1" 500 -

pstalidis commented 3 years ago

The preferable way is to access the image analyser directly (i.e POST and GET to fimage.westeurope.cloudapp.azure.com:5000/api/analyze_image)

For example this curl: curl -X POST -H "Content-Type: application/json" http://fimage.westeurope.cloudapp.azure.com:5000/api/analyze_image -d '{"url": "https://upload.wikimedia.org/wikipedia/commons/b/b4/Meloni_Salvini_Berlusconi.jpg"}' is working and returns: {"data":{"calculatedRating":-99,"calculatedRatingDetail":null,"contentSize":"1.19 MB","contentUrl":"https://upload.wikimedia.org/wikipedia/commons/b/b4/Meloni_Salvini_Berlusconi.jpg","encodingFormat":"image/jpeg","identifier":"18d0b86a83b72eb864c4e1f522cb99ff608c0360c7c1d1721855eae81c824f9275407de369","startDate":"2020-12-07T09:38:27.385770","status":"start","type":"image","uploadDate":"2019-08-23T08:09:47Z"},"message":"Successful Operation","status":200}

Then you can call the GET method of the same endpoint with what you got back (or at the minimum the identifier field) to retrieve the results (inside the "data" encapsulation or not; both work): curl -X GET -H "Content-Type: application/json" http://fimage.westeurope.cloudapp.azure.com:5000/api/analyze_image -d '{"data":{"calculatedRating":-99,"calculatedRatingDetail":null,"contentSize":"1.19 MB","contentUrl":"https://upload.wikimedia.org/wikipedia/commons/b/b4/Meloni_Salvini_Berlusconi.jpg","encodingFormat":"image/jpeg","identifier":"18d0b86a83b72eb864c4e1f522cb99ff608c0360c7c1d1721855eae81c824f9275407de369","startDate":"2020-12-07T09:38:27.385770","status":"start","type":"image","uploadDate":"2019-08-23T08:09:47Z"},"message":"Successful Operation","status":200}'

vittorianovancini commented 3 years ago

As of today the Image tool is still not working, please give it back to us... otherwise we can't check the system

macagari commented 3 years ago

I fixed it, it was a UI error. It should work by now, I checked it this morning