marcellejs / marcelle

An Interactive Machine Learning Toolkit
https://marcelle.dev
MIT License
44 stars 7 forks source link

python api / backend #12

Open ananis25 opened 2 years ago

ananis25 commented 2 years ago

(Apologies if this should rather go into the discussions tab)

Hi - I came across Marcelle from the citation in Apple's paper describing their Symphony framework. I have been looking into the docs and examples, and it looks super neat! I want to use Marcelle components and write new ones with computation backed by a python kernel. Python frameworks like Streamlit and Gradio have underpowered custom components or don't document them well.

I see documentation related to the python API but can't seem to find the related code. The example project iris-python only seems to run training offline in python and saving the model artifact rather than something that updates on interaction. Does the project scope includes bidirectional comms with python?

JulesFrancoise commented 2 years ago

Hi @ananis25,

My apologies for the late reply.

Thank you very much for your interest in Marcelle and for reaching out!

Indeed, we still need to document how Marcelle integrate with Python and to add more examples. I will summarize the capabilities of the current release and then outline some of the changes and features that are planned for the next release. According to your timeline, we can discuss how to proceed from there.

Currently, with the latest release (v0.5.1), the Python package provides an API to read and write data from a datastore over HTTP (the backend server must run on the same machine or be hosted somewhere). In particular, it includes:

Regarding examples, you will find 2 examples in the demos where the training is done in Python, and the models run on the web using ONNX-runtime. You can also find the code for the demos associated with the UIST paper on Github, and the demos are available online. In the second demo, we have a more advanced use of datastores to synchronize models trained with Python.

Now regarding limitations of the current integration with Python: because the communication with data stores uses HTTP, Python code cannot react to events from the web interface. We started reworking the Python package to use Socket.io, meaning that we can have python code reacting to events in the interface. There will be a number of important changes in the next release.

Depending on your use case and timeline, I can either guide you through an example with the current release or the next one. In order to continue the conversation, could you give us more details about your project, so that we understand the scenario better? In particular, what you want to do with Python and what you want to control from the interface, what Python libraries you are using, etc?

Best, Jules

ananis25 commented 2 years ago

Hi Jules, thanks for replying.

We started reworking the Python package to use Socket.io, meaning that we can have python code reacting to events in the interface.

I think this is close to what I was looking for! My use case is building richer visualization tools for working with data, for example a bunch of cross linked charts so that interactions with parts of them trigger GUI changes, run analysis on the selected data, etc.

I think the difference with Marcelle (which I missed the first time) is that the app state is primarily server side (useful for large datasets), rather than in the browser. I wonder if that is in the roadmap for Marcelle?