Skip to content
Closed
6 changes: 6 additions & 0 deletions .changeset/sad-stars-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/workflowcanvas": minor
"gradio": minor
---

feat:workflow: refactor InferenceClient endpoints logic
13 changes: 13 additions & 0 deletions demo/workflow_vlm_chat/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Ask a vision-language model about an image.

Drop in an image, type a question, run — the VLM answers in text. Uses the
`chat_completion` schema so the workflow works with any image-text-to-text
model regardless of which Inference Provider serves it.
"""

import gradio as gr

demo = gr.Workflow(graph="workflow.json")

if __name__ == "__main__":
demo.launch()
1 change: 1 addition & 0 deletions demo/workflow_vlm_chat/workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema_version":"2","name":"Ask About an Image","runtime":{"default":"client"},"references":[{"label":"Text","inputs":[{"id":"in","label":"Text","type":"text"}],"outputs":[{"id":"out","label":"Text","type":"text"}],"width":220,"height":163,"asset_type":"text","role":"reference","id":"81cf0eab-18c0-4d14-a2ce-217e2939ff2f","x":78.4375,"y":358.40234375,"data":{"in":"","out":""}}],"operators":[{"id":"op-vlm","label":"Kimi-K3","role":"operator","kind":"model","model_id":"moonshotai/Kimi-K3","endpoint":"chat_completion","pipeline_tag":"image-text-to-text","inputs":[{"id":"image","label":"Image","type":"image","required":false},{"id":"text","label":"Prompt","type":"text","required":false}],"outputs":[{"id":"out_0","label":"Text","type":"text","output_index":0}],"width":260,"height":184,"x":380,"y":180,"data":{"out_0":"Looks like you're tucked in somewhere cozy — maybe a van or camper? I can see wood paneling, some overhead lights, and what looks like bedding. Gives off late-night, settled-in-for-the-evening vibes.\n\nWhat's up with you? Just chilling, or is something on your mind?","text":"what going on "}}],"subjects":[{"id":"subj-answer","label":"Answer","role":"subject","asset_type":"text","inputs":[{"id":"in","label":"Text","type":"text"}],"outputs":[{"id":"out","label":"Text","type":"text"}],"width":320,"height":182,"x":720,"y":180,"data":{"in":"Looks like you're tucked in somewhere cozy — maybe a van or camper? I can see wood paneling, some overhead lights, and what looks like bedding. Gives off late-night, settled-in-for-the-evening vibes.\n\nWhat's up with you? Just chilling, or is something on your mind?"}}],"edges":[{"id":"e3","from_node_id":"op-vlm","from_port_id":"out_0","to_node_id":"subj-answer","to_port_id":"in","type":"text"},{"from_node_id":"81cf0eab-18c0-4d14-a2ce-217e2939ff2f","from_port_id":"out","to_node_id":"op-vlm","to_port_id":"text","type":"text","id":"8e33634e-9bba-4457-8138-76dff0c5ef35"}],"view":{"default":"canvas"}}
Loading
Loading