Open CambioML opened 1 month ago
Sorry, I mixed up the frontend and backend in my earlier explanation. The PHP is the frontend and the Python is the backend.
The PHP frontend displays the user interface. In index.php, when user uploads a file, the upload.php uploads the file to php's upload folder and sends a request $url = 'http://victsoi.pythonanywhere.com/ocr?filename=' . urlencode($newFilename); to the python backend. The backend Python server is also always running so that it will receive such request. The current python code copies the uploaded file to its 'uploads' folder first (but this is due to my python web space permissions, if I got a more time I will find a server to allow the php uploading to the python backend's hosting space directly), then the python backend does the image processing via google api.
I'm also learning mongodb these days. So for potential database solutions, what I will use is using mongodb atlas, creating a collection (table) in mongodb, and add the following fields
see sample connection configuration:
from pymongo.mongo_client import MongoClient
uri = "mongodb+srv://usernamel:
client = MongoClient(uri) try: client.admin.command('ping') print("Pinged your deployment. You successfully connected to MongoDB!") except Exception as e: print(e)
In your backend, it looks like it is invoking frontend server https://github.com/Lance-Tsui/cambioml/blob/main/python/ocr.py#L28-L38 to downloads file. Why not store files in the backend server instead of frontend? What is your design concept here and what kinds of improvement that you can think about proposing.