LVivona / Gradio-Flow

A web application with a backend in Flask and frontend in React, and React flow node base environment to stream both Gradio ( and later Streamlit ) interfaces, within a single application.
MIT License
39 stars 11 forks source link

possible to interconnect nodes? for sending inputs and outputs across nodes. #4

Open seshubonam opened 3 months ago

seshubonam commented 3 months ago

after deploying on local i can see the nodes are individual and cant be interconnected.

if you can elaborate on your insights for this feature, i can try and update a PR on this.

LVivona commented 3 months ago

I appreciate your interest. I'm also returning to this so you made perfect timing. :)

I tried to build my interconnected nodes. Still, at the time it required having to decouple the types from the gradio instance somehow, and that became somewhat difficult when looking at hosted gardio instances on Huggingface as there was no universal schema or API call to help determine if it was a specific type; but they changed that now so you can request the types of the gradio instance input/output, as well a js client making it easier to talk to gardio instances. making it far easier to communicate to the gradio instance

Current Requirements

If you have a far better solution, please let me know I would love to hear your thoughts because I facing a similar problem on a similar app, but there I have fewer constraints, on my schema since it's just one type

seshubonam commented 3 months ago

yay thanks for your response. its the only repo i have seen implementing gradio demos in react flow. and much ahead of time as gradio is still evolving currently to support different use cases.

here is an example of using a gradio demo as an api on a reactflow app:

https://x.com/zhouwenmeng/status/1812482238552158585?t=vSgrG9DeFqPn4VUphv5InQ&s=19

on a side note: in an app we experimented with gradio demos in group chatrooms like a gradio demo inside discord server channel. the goal was to show the inputs and outputs of one user to the others in the same chatroom and also be able to clone the same settings and start editing on that cloned gradio demo with same input parameters of the other user.

we were able to make this work by editing the app.py file and adding custom inputs from a previous demo.

but this needed us to host the isntance for inference instead of using the ZeroGPU instances provided for free inference on huggingface.

here is an issue referring to that:

https://github.com/gradio-app/gradio/issues/8844#issuecomment-2249117793

summary is that we were able to use io from gradio but not on the original demo or ZeroGPU. it needed self hosting using hf.co inference endpoints or we also tried to just use CPU instances on HF and routed api calls through replicate.

seshubonam commented 3 months ago

i will get back to you on the possible solutions after discussing with my developer who worked on this gradio demos for chatrooms. he fiddled a lot.with the input output parameters and may have a better solution.

seshubonam commented 3 months ago

initial version could have just the output of one be passed to the next demo as input

and here is a claude response on how to use gradio JS for this

https://accessible-record-6b0.notion.site/gradio-flows-8f171b7df1754d3b9fad11cd754e97f1?pvs=4

LVivona commented 3 months ago

Ah, I see within this context, were removing their Gradio UI, out of the equation, and building our input, I do agree that would defiantly simplify it, but I can see this posing some difficulty later down the line with data type one can just write by hand but even so, I agree this is probably a good start to expand on.

seshubonam commented 3 months ago

yup its a fuzzy way. will explore the claude response mentioned in the notion doc and update you what we find.

LVivona commented 3 months ago

yes, do let me know. :)