Reputation: 25
I have a fully functional gaze tracking code Python project which has been tested directly through the terminal. My guide wants me to implement this over the web. He wants all the processing to be done on the client-side because our servers are not powerful enough to handle multiple requests at the same time. My code involves the use of libraries like OpenCV, DLIB and mediapipe. I wanted to know whether is it possible to implement the code on the client-side by using python itself.
And project contains import statements as
import cv2
import dlib
from enum import Enum
from threading import Timer
import pyautogui
Even if I switch to JavaScript for client-side scripting will it result in performance losses, is there any way to avoid them? Is there any other way to implement the code on the client-side by keeping everything in python?
Upvotes: 0
Views: 397
Reputation: 6732
Not usually a done thing, JS is the only really supported browser-client-side language, although you can now also use WASM.
There are a few JS tools to allow Python running in the browser, most popularly Brython and Skulpt. However, they may not work with all your imported packages, and will be much slower than writing your code in JS.
It's worth giving those two a go, but unfortunately, I think you may have to move to JS, or to wrapping your code in a web app framework (eg django) to allow the processing to happen on the server, where it has access to those libraries.
Upvotes: 0