skip to Main Content

I’ve developed a basic recommendation system using Python and the cosine similarity algorithm. Now, I’m interested in creating a Laravel application to integrate this recommendation system. However, I’m unsure about how to establish the connection between the two.
Any assistance would be greatly appreciated!

i did not find anything to start with !!

5

Answers


  1. There may be a way to do this with Laravel applications but I’m not sure what that would be. However, we have django in python, which may be a good way to resolve your problem, as Django is already a really easy module to install on python.

    From what I was able to find on the web, a python module called VADER is also able to do stuff with PHP and all that.

    I’d recommend looking into Django as it’s considered the default for using python with a web-framework.

    Login or Signup to reply.
  2. I don’t believe there’s a good reason to use Laravel + Python here as you would be adding complexity for no clear reason.

    I would agree with others about leveraging Django/Flask rather than added another Language + Stack.

    I’m going to assume you need to deliver this on demand, such as viewing youtube’s home page and seeing recommendations.

    What you could do is execute shell commands from Laravel, but this is dangerous and you should avoid it all costs.

    The only other option I can think of is to create a HTTP API in the python application that you only expose to the Laravel application, but it doesn’t fully make sense to have two web applications in two different languages and frameworks as mentioned.

    If you don’t need it to be a realtime feature then you could run the python application on a set schedule that stores the results in the same database your Laravel application leverages.

    Login or Signup to reply.
  3. you can create a flask or fastapi application in python to serve as an api for your recommendation system. this api will receive input data from your laravel application and return the recommended results. so you’ll have two servers: one for generate recomendation and the other is your main server with laravel.

    Login or Signup to reply.
  4. What is the reason for choosing these two framework?

    Login or Signup to reply.
  5. As others have correctly pointed out, the preferred solution should be to not switch languages and directly implement your API with Python, that is use Flask or FastAPI to implement your recommendation system’s API.

    If you really want/have to use PHP for your endpoint, you may want to checkout ONNX. ONNX is another type of ML model format that offers runtimes for other languages than Python, such as C++, Java or PHP. You can export your model from PyTorch or TensorFlow to ONNX (refer to the respective documentation), and then use the resulting ONNX in the onnxruntime of your respective target language. This is only applicable if your model inference code is representable as computation graph, which probably is the case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search