Spaces:
Build error
Build error
initial upload
Browse filesFiles changed (3)
- app.pyAdded+58
- readme.mdAdded+13
- requirements.txtAdded+3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import gradio as grimport pandasimport PIL
# Dummy function for Workflow Adef workflow_a(image, text): # Here you might process the image/text in a specific way. return "Workflow A executed!"
# Dummy function for Workflow Bdef workflow_b(image, text): # Here you might process the image/text in a different way. return "Workflow B executed!"
# Main function triggered by the Start button.# It uses an if statement to decide which workflow to call.def main(image, text): # Example condition: if the text (after stripping whitespace) equals "a" (case-insensitive), call workflow_a. if text.strip().lower() == "a": result_text = workflow_a(image, text) else: result_text = workflow_b(image, text)
# Forward the input image to both image outputs. return image, image,
# Build the Gradio interface using Blocks for a custom layout.with gr.Blocks() as demo: gr.Markdown("## Gradio Demo: Workflow Selector")
# Input components in a row. with gr.Row(): image_input = gr.Image(label="Input Image") text_input = gr.Textbox(label="Input Text", placeholder='Type "a" for workflow A or anything else for workflow B')
# Start button to trigger the main function. start_button = gr.Button("Start")
gr.Markdown("### Outputs") # Output images in a row. with gr.Row(): output_image1 = gr.Image(label="Output Image 1") output_image2 = gr.Image(label="Output Image 2")
output_text = gr.Textbox(label="Output Text")
# Connect the Start button to the main function. start_button.click( fn=main, inputs=[image_input, text_input], outputs=[output_image1, output_image2, output_text] )
# Launch the Gradio app.demo.launch(share=True)12345678910111213---title: DummyGradioAppemoji: 🌍colorFrom: redcolorTo: greensdk: gradiosdk_version: 5.16.0app_file: app.pypinned: false---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
123gradiopandasPILapp.pyAdded+58
readme.mdAdded+13
requirements.txtAdded+3