bareun-nlp / RBareun

R library for bareun NLP
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

curl error #29

Closed sdkparkforbi closed 1 year ago

sdkparkforbi commented 1 year ago

If the program is run as below, a curl-related error occurs in pos(). It's hard to find the reason. Can someone look for a solution?

library(curl) library(httr) library(rjson) library(bareun)

apikey <- "XXXXXXXXXXXXXXXXXXXXXXXX" # API-Key server <- "http://localhost:5655" set_api(apikey, server) t <- tagger()
text <- "밤은 밤이다."
pos(t, text)

The result shows like;
Error in curl::curl_fetch_memory(URL, handle = handle) : Could not resolve host: http

hunbl commented 1 year ago

Make sure the bareun server is running on "localhost:5655"

sdkparkforbi commented 1 year ago

I can check server is working.

image

gih2yun commented 1 year ago

@sdkparkforbi Sorry, you should run the server with docker version. Docker version only support http REST API through envoyproxy.

We will update our document for this repo.

gih2yun commented 1 year ago

@sdkparkforbi In addition, Docker versions are currently only available for Linux and Windows OS.

hunbl commented 1 year ago

@sdkparkforbi

I`m sorry. For 'server', you only need to enter the "server name" or "server address".

NOT server <- "http://localhost:5655"

JUST server <- "localhost"

sdkparkforbi commented 1 year ago

Thank you for your kind and detailed explanation. In Python, coding as below works well, but why do I need to run a server using Docker in R? Since I am in a position to study Docker, I want to know exactly why.

image

sdkparkforbi commented 1 year ago

I solved it by installing windows docker. Thank you for help.

image

sdkparkforbi commented 1 year ago

I summarized the two documents below and organized them into 14 steps. https://www.lainyzine.com/ko/article/a-complete-guide-to-how-to-install-docker-desktop-on-windows-10/ https://docs.bareun.ai/install/docker/#_2

  1. Run Command Prompt in Administrator Mode

  2. wsl (windows subsystem for linux) installation

    wsl --install

  3. If you find installation error above, you can execute the following two commands

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart wsl --update

  4. Changed WSL version to 2

    wsl --set-default-version 2

  5. Confirm that both commands have ended with the output of ‘completed’ and reboot Windows

  6. After the Ubuntu installation screen appears, if an ID is requested, an ID is created and entered, and if a password is requested, a password is created.

  7. Download and run the latest WSL2 Linux kernel update package for x64 machine from the link below https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

  8. Go to the link below and download Docker Desktop for Windows https://www.docker.com/products/docker-desktop/

  9. Setup by running Docker Desktop Installer.exe

  10. Run the Docker Desktop icon

  11. Run Command Prompt in Administrator Mode

  12. Install bareun using Docker command

    docker pull bareunai/bareun:latest

  13. Run server

    docker run -d --restart unless-stopped --name bareun -p 5757:5757 -p 9902:9902 -v ~/bareun/var:/bareun/var bareunai/bareun:latest

  14. Register API Key

    docker exec bareun /bareun/bin/bareun -reg [your own API Key]

gih2yun commented 1 year ago

Thank you for your kind and detailed explanation. In Python, coding as below works well, but why do I need to run a server using Docker in R? Since I am in a position to study Docker, I want to know exactly why.

@sdkparkforbi

Bareun runs as a server that supports grpc as its primary transport protocol. At first we tried to support grpc in bareun client R version, but it took too much dependency. So we decided to use the HTTP protocol in the R version. HTTP has been implemented in a way that uses an envoy proxy, which is supported only by Docker.

It takes some hacking to support grpc in R. We also know how to help you eliminate dependencies as well. But I'm always running out of time.

  1. Develop bareun client in Go language version
  2. Bind this back into a shared library to C language.
  3. Use the shared library above in R

Thank you for your question.

gih2yun commented 1 year ago

@sdkparkforbi

I summarized the two documents below and organized them into 14 steps. https://www.lainyzine.com/en/article/a-complete-guide-to-how-to-install-docker-desktop-on-windows-10/#google_vignette https://docs.bareun.ai/install/docker/#_2

  1. Run Command Prompt in Administrator Mode
  2. wsl (windows subsystem for linux) installation

wsl --install

  1. Changed WSL version to 2

wsl --set-default-version 2

  1. Execute the following two commands

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

  1. Confirm that both commands have ended with the output of ‘completed’ and reboot Windows
  2. After the Ubuntu installation screen appears, if an ID is requested, an ID is created and entered, and if a password is requested, a password is created.
  3. Download and run the latest WSL2 Linux kernel update package for x64 machine from the link below https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
  4. Go to the link below and download Docker Desktop for Windows https://www.docker.com/products/docker-desktop/
  5. Setup by running Docker Desktop Installer.exe
  6. Run the Docker Desktop icon
  7. Run Command Prompt in Administrator Mode
  8. Install bareun using Docker command

docker pull bareunai/bareun:latest

  1. Run server

docker run -d --restart unless-stopped --name bareun -p 5757:5757 -p 9902:9902 -v ~/bareun/var:/bareun/var bareunai/bareun:latest

  1. Register API Key

docker exec bareun /bareun/bin/bareun -reg [your own API Key]

Great. We will update our document on this. Also We will refer it too. Thanks.