askplatypus / syntaxnet-api

A small HTTP API for SyntaxNet
Apache License 2.0
19 stars 18 forks source link

Problems with syntaxnet_wrapper #5

Open fiammettaAtGit opened 7 years ago

fiammettaAtGit commented 7 years ago

Hi. I just installed your code but I'm just experiencing problems with starting it. After installing all the needed dependencies (flask, swig ui, etc..), now I have problem while running the flask_server.py to run service over 7000 port. Please, could you provide me more information about correctly installing syntaxnet_wrapper, cause I followed the provided instructions, but it doesn't work!:-((

thanks

Tpt commented 7 years ago

Hi. I just installed your code

Great! Thank you!

now I have problem while running the flask_server.py to run service over 7000 port.

What is your problem? Do you have any error message?

PS: installation is much easier with docker. syntaxnet_api is very painful to install "by hand".

fiammettaAtGit commented 7 years ago

Hello, I was finally successful in installing your code. It works great! thank you!

Let me ask you something else:

I would like to invoke your server by a Java Application, in order to submit sentences non by hand, but pulling it from a text file.

Is there any API I could use to do that?

I'm just thinking to take in input the tex-file containing the sentences list and splitting them, in order to submit a single sentence request.

But, can you provide me an API (if it possible), to submit a HTTP POST request to your server instead of using the GUI? Thanks in advance Fiammetta

Tpt commented 7 years ago

I was finally successful in installing your code. It works great! thank you!

Great! Congrats!

Is there any API I could use to do that?

Yes, just POST to https://MY_INSTANCE/v1/parsey-universal-full with the text to parse in the request body and the language code in the "Content-Language" HTTP header.

Example with cUrl: curl -X POST --header 'Content-Type: text/plain; charset=utf-8' --header 'Content-Language: en' -d 'Where is Paris' 'https://HOST/v1/parsey-universal-full'

fiammettaAtGit commented 7 years ago

Thank you so much for your quick answers! I'm just fixing my problems as they come to me!! Well, I just wrote my Java code following your instructions. HTTP POST message, sent to your online server url ("http://syntaxnet.askplatyp.us/v1/parsey-universal-full"), works great!!

Now, I'm just trying to forward the same request to my local instance, setting the url to: "https://127.0.0.1:7000/v1/parsey_universal_full".... But I'm just receiving 405 response code for bad request syntax. Have you ever got problems like this one before? Thanks in advance, Fiammetta

Tpt commented 7 years ago

Do you experienced problems like this before?

No, did not had such problem. Is the UI of your instance working or not?

fiammettaAtGit commented 7 years ago

Actually, the UI of my local instance does not work well. UI starts but when I try to submit any request, in any language, I got a 0 code response:

Here is the details provided from my local UI (it seems to try to connect anyway to your remote instance..).

Request URL

http://syntaxnet.askplatyp.us/v1/parsey-universal-full

Response Body

no content

Response Code

0

Response Headers

{ "error": "no response from server" }

fiammettaAtGit commented 7 years ago

Here is the command line response I got when I tried to submit a request on my local instance UI:

i# python flask_server.py INFO:werkzeug: * Running on http://127.0.0.1:7000/ (Press CTRL+C to quit) INFO:werkzeug:127.0.0.1 - - [23/May/2017 12:01:08] "GET / HTTP/1.1" 302 - INFO:werkzeug:127.0.0.1 - - [23/May/2017 12:01:08] "GET /v1 HTTP/1.1" 200 - INFO:werkzeug:127.0.0.1 - - [23/May/2017 12:01:09] "GET /v1/swagger.json HTTP/1.1" 200 -

Tpt commented 7 years ago

Could you send me the response when you send a request to your instance from the command line (or any programming language?)

fiammettaAtGit commented 7 years ago

Hi, sorry for answering only now. Here is what I usually do:

  1. As First, I just start my local instance for the HTTP Server from command line; here is the output (it seems to be ok):

root@fiammetta-Veriton-M2631G:/home/fiammetta/swrap/syntaxnet-api# python flask_server.py INFO:werkzeug: * Running on http://127.0.0.1:7000/ (Press CTRL+C to quit)

I observed problems also by using the UI of my local instance. In fact, filling in my simple sentence "My cat is always hungry" in the UI form, I just got this response:

Response Headers

{ "error": "no response from server" }

In the corresponding terminal windows, these are the message displayed:

INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:14:55] "GET / HTTP/1.1" 302 - INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:14:55] "GET /v1 HTTP/1.1" 200 - INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:14:55] "GET /v1/swagger.json HTTP/1.1" 200 -

Otherwise, if I run my Java Code, building a Post request addressed to the following url: url = new URL("http://127.0.0.1:7000/v1/parsey_universal_full"); I just got a lot of Java Exception Message Codes and these messages in the command line windows:

INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:20:03] "POST /v1/parsey_universal_full HTTP/1.1" 404 - INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:20:03] "POST /v1/parsey_universal_full HTTP/1.1" 404 - INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:20:03] "POST /v1/parsey_universal_full HTTP/1.1" 404 - INFO:werkzeug:127.0.0.1 - - [26/May/2017 16:20:03] "POST /v1/parsey_universal_full HTTP/1.1" 404 -

Tpt commented 7 years ago

Hi! I believe I've found why you get a 404 error: You are trying to use '/v1/parsey_universalfull' instead of '/v1/parsey-universal-full' (with "" instead of "-")