Open wholesomemoon opened 3 years ago
Also, it is not good to disclose the IP address. It is necessary to think about how to hide the address from the public.
Maybe it will be good idea to pass a geojson file into API. For instance,
class VideoFramePyMeta(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
instance = super().__call__(*args, **kwargs)
cls._instances[cls] = instance
return cls._instances[cls]
class VideoFramePy(metaclass=VideoFramePyMeta):
def run(self, json):
# TODO: complete your logic
It would be reasonable to insert parameters such as an image path, encoding type, or server URL into the geojson file. This is because external users can set the parameters up. BTW, the API is designed to use singleton in this case. Maybe sample codes will be formed like:
import videoframepy
if __name__ == "__main__":
vfpy = VideoFramePy()
vfpy.run('app.json')
My next step will be making the server running code pick up the sent images, and do something with it. At the very least, it will extract the average RGB value of an image and send it together with the initial response message. I should modularize each function, right?
You said that you would modularize each function, but actually, I don't know if modularization would be meaningful if you only aim to get the RGB average. Because if you're going to get the average RGB value anyway, it'll be over in 2-3 lines of code at most of the time.
In other words, the length of your logic is too short(small) to divide into such modules.
The current videoframepy is as follows:
The thing is that the videoframepy cannot be never used by an external user in this form. A reasonable solution is to wrap all the main logics in the form of a function and provide the function to the external users, as in the form of an API.