Coder Social home page Coder Social logo

Comments (9)

wjiuhe avatar wjiuhe commented on June 2, 2024

Hi,  你好,

Pinfer 命令

如果使用 pinfer 命令启动服务,可以通过 --backend-port 参数修改端口

如:

pinfer  app:service --backend-port 8080

要想查看该命令的所有参数,可以执行

pinfer --help

或者访问 CLI 的文档页面 CLI

Uvicorn 命令

如果使用 uvicorn 启动服务,可以通过 --port 参数修改端口

如:

uvicorn  app:service --port 8080

要想查看该命令的所有参数,可以执行

uvicorn --help

关于你提出的文档没有找到的问题。对于常见的问题,我想我们后面加一个 FAQ 的页面会比较好,我会后续把这部分补充好。

from pinferencia.

jeffrover avatar jeffrover commented on June 2, 2024

I could access the document on http://127.0.0.1:8000, but could not access the GUI from web browser on http://127.0.0.1:8501, as described.

When "pinfer app:service", I could see
Pinferencia: Frontend component streamlit is starting...
Pinferencia: streamlit address will be shown once it has started

Pinferencia: Backend component uvicorn is starting...
Pinferencia: uvicorn address will be shown once it has started

But a few seconds later, I only saw
Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Never get streamlit address back.

Did I miss anything?

from pinferencia.

wjiuhe avatar wjiuhe commented on June 2, 2024

I could access the document on http://127.0.0.1:8000, but could not access the GUI from web browser on http://127.0.0.1:8501, as described.

When "pinfer app:service", I could see Pinferencia: Frontend component streamlit is starting... Pinferencia: streamlit address will be shown once it has started

Pinferencia: Backend component uvicorn is starting... Pinferencia: uvicorn address will be shown once it has started

But a few seconds later, I only saw Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) Never get streamlit address back.

Did I miss anything?

Hi, @jeffrover

Would you mind sharing your installed version of pinferencia and streamlit?

You can get the result with

pip freeze | grep pinferencia
pip freeze | grep streamlit

And I would like to confirm, the below messages are not shown in your console?
image

from pinferencia.

wjiuhe avatar wjiuhe commented on June 2, 2024

@jeffrover Also, can you try to run the following script with streamlit to check if there are any error messages?

Save the following file to your computer:

https://github.com/underneathall/pinferencia/blob/main/examples/custom_frontend/frontend.py

Run the following command and check the output

streamlit run frontend.py

from pinferencia.

jeffrover avatar jeffrover commented on June 2, 2024

pinferencia 0.2.1
streamlit 1.13.0
You're right, the red box wasn't showing.
When I tried "streamlit run frontend.py", firefox browser loaded "My awesome model" page, backend wasn't load, I supposed that's ok for this test.
The URL is localhost:8051, which was prompt on my terminal.

from pinferencia.

wjiuhe avatar wjiuhe commented on June 2, 2024

pinferencia 0.2.1 streamlit 1.13.0 You're right, the red box wasn't showing. When I tried "streamlit run frontend.py", firefox browser loaded "My awesome model" page, backend wasn't load, I supposed that's ok for this test. The URL is localhost:8051, which was prompt on my terminal.

Thanks for the reply, @jeffrover.

Some extra help

Environment

I will need some extra information to try to reproduce the case, please kindly provide the following information:

  • Operating system and its version
  • Python Version
  • A full pip freeze output if possible

Some debug help

At the meantime, if you have time, can you try the following command to see if it also fails to start the streamlit server?

1. Run the frontend-only mode

pinfer --mode=frontend http://127.0.0.1:8000

2. Run the frontend with custom script

https://github.com/underneathall/pinferencia/blob/main/examples/custom_frontend/frontend.py

pinfer --mode=frontend http://127.0.0.1:8000 --frontend-script=frontend.py

Temporary fix

I'm sorry about the trouble you met. As a temporary fix, you can save the following codes as default.py,

from pinferencia.frontend.app import Server


service = Server(backend_server="http://127.0.0.1:8000")

And manually start the frontend server

streamlit run default.py

And the backend server:

pinfer --mode=backend app:service

Then you should be able to use the frontend properly.

I'll try to reproduce the problem and locate the cause asap.

from pinferencia.

jeffrover avatar jeffrover commented on June 2, 2024

@wjiuhe ,
Thank you for the quick reply and details.
I'm using CentOS 7, python 3.8.2
pkg.txt

I tried the two pinfer (of explicit frontend), both worked. I tried your temp fix, it also worked. I'll just continue my exploring with it. By the way, I like the minimalistic design style of pinferencia!

from pinferencia.

wjiuhe avatar wjiuhe commented on June 2, 2024

Thank you, @jeffrover.

I may need some time to reproduce the problem using your environment setting.

This problem might be due to something wrong in python multiprocessing per environment. Pinferencia uses a separate process to start the frontend with the default mode. This explains why starting with the frontend mode is working.

from pinferencia.

wjiuhe avatar wjiuhe commented on June 2, 2024

Hi, @jeffrover.

As I don't have a CentOS machine, I use the CentOS docker image to set up the environment. However, I'm having trouble reproducing the problem.

I suspect there are some conflicts causing python multiprocessing module not working properly.

If you have time, can you help try the example on the Python Official site to ensure the multiprocessing module is normal?

Example

Save the codes below as test.py and run python test.py.

from multiprocessing import Process

def f(name):
    print('hello', name)

if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

Check if "hello bob" appears in the console output.

Python Image as the Environment

Meanwhile, you can try to use a Python Docker image as the environment to try out pinferencia.

For example:

docker pull python:3.10-buster
docker run -it python:3.10-buster bash

then

pip install "pinferencia[streamlit]"

from pinferencia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.