pythonpandasgoogle-bigqueryjupyter-notebookgoogle-colaboratory

Is There a Way to Expose a Plot Generated Using a Pandas Dataframe as a Jupyter Notebook as an App to the End User?


Current Workflow

Right now, me, as an ML engineer, am using a jupyter notebook to plot some pandas dataframes. Basically, inside the jupyter notebook, I am setting some hard-coded configurations like

k_1:float=2.3
date_to_analyse:str='2024-06-17' # 17th June 
region_to_analyse:str='montana'
...

Based on the hardcoded parameters like above, the notebook (along with some helper functions) runs a query to my company's data warehouse in Google Big Query, crunches a few numbers, applies some business logic and generates a pandas dataframe for transaction numbers minute by minute throughout the day.

The plot of the pandas dataframe is what's important to the business user, which I show to them as part of our model evaluation metric.

The logic is straightforward enough, and captured in the figure below.

enter image description here

Objective

I am tasked with making this into a self-service application directly usable by the business team, where a user can

I don't have a dedicated frontend guy, neither do I have frontend experience myself. So was just wondering whether there is a simple enough solution (best if serverless, and part of the GCP eco-system) that can accomplish this?

I know about Google colab notebooks (basically, jupyter notebook, right?), but have not tried them. Can they provide a simple way to expose the notebook's functionality (generate the plots from user provided configs)


Solution

  • If you can expose the notebook to users (load credentials via env vars etc.) you can use IPython widgets.

    Google collab has forms and allows you to hide the code, if you think filling out a form an pressing the play button left of the field is managable for your userbase that is an option as well.

    While not totally serverless gradio, huggingfaces ui library makes it simple enough to create simple webinterfaces. You can get an internal and a public address for it. You could run the gradio code in google collab as well.