Barfi : Flow Based Programming for Data Science (New Component)

I wanted a Flow Based Programming tool to be integrated within my workflow. So, built barfi, which provides a streamlit component. Still work in progress, would appreciate feedback and ideas. Have uses cases? Would be great to know them :slight_smile:

Here is a demo app.

Repository here: https://github.com/krish-adi/barfi

Quickstart

pip install barfi
from barfi import st_barfi, Block

my_block = Block(name='My Block')
my_block.add_input()
my_block.add_output()

st_barfi(base_blocks=[my_block])

demo

9 Likes

Hey @krishadi ,

Welcome to the Streamlit community Forum :partying_face: :balloon:

This is a pretty cool implementation. Love the idea. Great work ! :hugs:

Best
Avra

1 Like

Welcome @krishadi,

Nice work! I wanted to build a graph-based Pandas query builder one day, maybe I can use this for it :slight_smile:

Feel free to add it to the Streamlit Components - Community Tracker - Show the Community! - Streamlit so we don’t lose track of it.

Have a nice day,
Fanilo

That sounds like an interesting use-case. Let me know if you need some particular UI components to pull it off.

Welcome @krishadi :balloon:,

This component could be very promising. A few thoughts and ideas:

  • Could it be used to represent an ML process? First I have a loader (specification option of the file path, then I pass the data to a preprocessor e.g. SentenceSplitter or similar, then to the model for training (selection model possible, etc.).
  • Another idea could be to use it to model the architecture neural networks? That is, first input layer (with modification options of the neurons, then other layers).

A small demo of how to use the component (maybe with one of my suggestions?) in practice would emphasize the usefulness of the component for me and increase the barrier to use the component.

Best regards
Chris

Hey @chris_klose !

Both the use-cases are definitely possible. For

Case 1: You would need a text input box in the 1st Block (I am building that as we I write this) and the other Blocks you can specify the logic. Do you some parts of the SentenceSplitter and the Model implemented somewhere?

Case 2: You would need an a number input or a dropdown to select the specifics of the layer in the Block. I’ll implement this as well. Do you have an example neural network use-case that I can implement this for?

Thanks for the idea! :smiley:

Adithya

1 Like

Case 1: I guess something super simple would do e.g. tf-idf-transformer, label-encoder etc. from sklearn ( sklearn.preprocessing.LabelEncoder — scikit-learn 1.0.2 documentation) .
Would be a cheap version of ML Azure Studio’s interface :smiley: .

Cas 2: Maybe a simple NN for MNIST with keras? (The Functional API (keras.io)) It would also require to allow other params such as activation by selecting it from a dropdown too.

image

1 Like

Hey @chris_klose ,

Now the blocks have input-options.

  1. Here is the sample app for Case 1: https://share.streamlit.io/krish-adi/barfi-cklose/app.py . The docs are not yet updated, but you can use the code here and here to understand how to further implement this.

  1. Now the Blocks have various input options you can make use of. Here is a playground of all the inputs: https://share.streamlit.io/krish-adi/barfi-blocks/app.py . The documentation is not complete for this, but you can use the code of the blocks to understand how to implement it for your use-case. Check it here: barfi-blocks/blocks at master · krish-adi/barfi-blocks · GitHub

Let me know if you run into any trouble.

Happy coding :slight_smile:

3 Likes

Great work. My use case is a multi-modal AI workflow. Static LLM prompts that kick off multiple responses that can flow into their own workflows and connect with additional models like image gen platforms.

Hi @Matt_Marcus this is great component!
Thanks for creating!

A quick question, is it possible to use the compute engine to get_result from a saved schema without loading the component in to UI?

It’s great, thanks a lot. Suggestion: It would be great if it was mobile friendly