hsuwill000 commited on
Commit
8845fa7
·
verified ·
1 Parent(s): 0264023

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -49,21 +49,18 @@ def infer_gradio(prompt: str):
49
  return None # Return nothing if an error occurs
50
 
51
  # Define Gradio Interface
52
- with gr.Blocks() as demo:
53
- with gr.Row(): # Use a Row to place the prompt input and the button side by side
54
- prompt_input = gr.Textbox(
55
- placeholder="Type your prompt for image generation here",
56
- lines=1, # Set the input to be only one line tall
57
- interactive=True, # Allow user to interact with the textbox
58
- elem_id="prompt-input" # Optional: For CSS styling
59
- ).style(
60
- width="80%" # Set the prompt input width to 4/5
61
- )
62
-
63
- # Change the button text to "RUN:" and align it with the prompt input
64
- run_button = gr.Button("RUN:").style(
65
- width="20%" # Set the button width to 1/5
66
- )
67
 
68
  # Output image display area
69
  output_image = gr.Image(label="Generated Image")
 
49
  return None # Return nothing if an error occurs
50
 
51
  # Define Gradio Interface
52
+ with gr.Blocks(css=".input-container { display: flex; align-items: center; justify-content: space-between; } .input-container .textbox { width: 80%; } .input-container .button { width: 20%; }") as demo:
53
+ with gr.Column():
54
+ # Use a Row with CSS class to control layout
55
+ with gr.Row(elem_id="input-container"):
56
+ prompt_input = gr.Textbox(
57
+ placeholder="Type your prompt for image generation here",
58
+ lines=1, # Set the input to be only one line tall
59
+ interactive=True # Allow user to interact with the textbox
60
+ ).style(class_name="textbox") # Assign CSS class for width control
61
+
62
+ # Change the button text to "RUN:" and align it with the prompt input
63
+ run_button = gr.Button("RUN").style(class_name="button") # Assign CSS class for width control
 
 
 
64
 
65
  # Output image display area
66
  output_image = gr.Image(label="Generated Image")