Spaces:
Build error
Build error
simplified to text input and text output
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ def workflow_b(image, text):
|
|
| 18 |
|
| 19 |
# Main function triggered by the Start button.
|
| 20 |
# It uses an if statement to decide which workflow to call.
|
| 21 |
-
def
|
| 22 |
# Example condition: if the text (after stripping whitespace) equals "a" (case-insensitive), call workflow_a.
|
| 23 |
if text.strip().lower() == "a":
|
| 24 |
result_text = workflow_a(image, text)
|
|
@@ -28,7 +28,11 @@ def main(image, text):
|
|
| 28 |
# Forward the input image to both image outputs.
|
| 29 |
return image, image, result_text
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Build the Gradio interface using Blocks for a custom layout.
|
| 34 |
with gr.Blocks() as demo:
|
|
@@ -53,8 +57,10 @@ with gr.Blocks() as demo:
|
|
| 53 |
# Connect the Start button to the main function.
|
| 54 |
start_button.click(
|
| 55 |
fn=main,
|
| 56 |
-
inputs=[image_input, text_input],
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
)
|
| 59 |
|
| 60 |
# Launch the Gradio app.
|
|
|
|
| 18 |
|
| 19 |
# Main function triggered by the Start button.
|
| 20 |
# It uses an if statement to decide which workflow to call.
|
| 21 |
+
def main_ori(image, text):
|
| 22 |
# Example condition: if the text (after stripping whitespace) equals "a" (case-insensitive), call workflow_a.
|
| 23 |
if text.strip().lower() == "a":
|
| 24 |
result_text = workflow_a(image, text)
|
|
|
|
| 28 |
# Forward the input image to both image outputs.
|
| 29 |
return image, image, result_text
|
| 30 |
|
| 31 |
+
def main_ori(text):
|
| 32 |
+
# Example condition: if the text (after stripping whitespace) equals "a" (case-insensitive), call workflow_a.
|
| 33 |
+
|
| 34 |
+
# Forward the input image to both image outputs.
|
| 35 |
+
return "ok, that worked!"
|
| 36 |
|
| 37 |
# Build the Gradio interface using Blocks for a custom layout.
|
| 38 |
with gr.Blocks() as demo:
|
|
|
|
| 57 |
# Connect the Start button to the main function.
|
| 58 |
start_button.click(
|
| 59 |
fn=main,
|
| 60 |
+
#inputs=[image_input, text_input],
|
| 61 |
+
inputs=[text_input],
|
| 62 |
+
#outputs=[output_image1, output_image2, output_text]
|
| 63 |
+
outputs=[output_text]
|
| 64 |
)
|
| 65 |
|
| 66 |
# Launch the Gradio app.
|