Spaces:
Runtime error
Runtime error
Commit ·
9a15405
1
Parent(s): 1b56997
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,123 +1,142 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
from random import choice
|
| 4 |
-
os.chdir("C:\\Users\\Ray Ochoa\\OneDrive\\Node x Mooed")
|
| 5 |
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
return {moodboard_image: choice(image_list)}
|
| 10 |
|
| 11 |
with gr.Blocks() as app:
|
| 12 |
-
|
| 13 |
gr.Markdown("# Magazine Layouts")
|
| 14 |
|
| 15 |
with gr.Tab("The Minimalist Layout"):
|
| 16 |
with gr.Column():
|
| 17 |
gr.Markdown("## Minimalist")
|
| 18 |
-
gr.Image(
|
| 19 |
gr.Textbox(lines=4, value="It was a stormy night, and the vintage car roared down the highway.")
|
|
|
|
|
|
|
| 20 |
|
| 21 |
with gr.Tab("The Grid Layout"):
|
| 22 |
with gr.Row():
|
| 23 |
with gr.Column(scale=1):
|
| 24 |
-
gr.Image(
|
| 25 |
gr.Textbox(lines=4, value="The old leather seats had stories to tell.")
|
|
|
|
|
|
|
| 26 |
with gr.Column(scale=1):
|
| 27 |
-
gr.Image(
|
| 28 |
gr.Textbox(lines=4, value="With every curve and turn, the car seemed to whisper.")
|
|
|
|
|
|
|
| 29 |
|
| 30 |
with gr.Tab("The Asymmetrical Layout"):
|
| 31 |
with gr.Row():
|
| 32 |
with gr.Column(scale=2):
|
| 33 |
gr.Markdown("## Artistic Layout")
|
| 34 |
-
gr.Image(
|
|
|
|
|
|
|
| 35 |
with gr.Column(scale=1):
|
| 36 |
-
gr.Image(
|
| 37 |
gr.Textbox(lines=3, value="As the dawn broke, the car finally stopped.")
|
|
|
|
|
|
|
| 38 |
|
| 39 |
with gr.Tab("The F-Layout"):
|
| 40 |
with gr.Row():
|
| 41 |
with gr.Column(scale=3):
|
| 42 |
-
gr.Image(
|
|
|
|
|
|
|
| 43 |
with gr.Column(scale=1):
|
| 44 |
gr.Textbox(lines=4, value="It was a stormy night, and the vintage car roared down the highway.")
|
| 45 |
|
|
|
|
| 46 |
with gr.Tab("The Radial Layout"):
|
| 47 |
with gr.Row():
|
| 48 |
with gr.Column(scale=1):
|
| 49 |
-
gr.Image(
|
|
|
|
|
|
|
| 50 |
with gr.Column(scale=1):
|
| 51 |
-
gr.Image(
|
|
|
|
|
|
|
| 52 |
with gr.Row():
|
| 53 |
with gr.Column(scale=1):
|
| 54 |
-
gr.Image(
|
|
|
|
|
|
|
| 55 |
with gr.Column(scale=1):
|
| 56 |
gr.Textbox(lines=4, value="As the dawn broke, the car finally stopped.")
|
| 57 |
with gr.Column(scale=1):
|
| 58 |
-
gr.Image(
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
with gr.Tab("Trading Card Layout 1"):
|
| 61 |
with gr.Column():
|
| 62 |
-
gr.Image(
|
|
|
|
|
|
|
| 63 |
gr.Textbox(lines=1, value="Car Model: Mustang")
|
| 64 |
gr.Textbox(lines=1, value="Year: 1965")
|
| 65 |
gr.Textbox(lines=2, value="Stats: Speed 200mph, Mileage 15mpg")
|
| 66 |
gr.Textbox(lines=3, value="The Mustang is a classic American muscle car.")
|
| 67 |
|
| 68 |
-
# Museum Art Gallery: Spotlight Layout
|
| 69 |
with gr.Tab("Spotlight Layout"):
|
| 70 |
-
gr.Image(
|
|
|
|
|
|
|
| 71 |
with gr.Row():
|
| 72 |
gr.Textbox(lines=1, value="Art: Moonlit Sonata")
|
| 73 |
gr.Textbox(lines=1, value="Artist: L. Vinci")
|
| 74 |
gr.Textbox(lines=1, value="Year: 1911")
|
| 75 |
gr.Textbox(lines=3, value="A single spotlight shines on this masterpiece, illuminating its intricate details and vivid colors.")
|
| 76 |
|
| 77 |
-
# Museum Art Gallery: Interactive Kiosk Layout
|
| 78 |
with gr.Tab("Interactive Kiosk Layout"):
|
| 79 |
with gr.Row():
|
| 80 |
with gr.Column(scale=1):
|
| 81 |
-
gr.Image(
|
|
|
|
|
|
|
| 82 |
with gr.Column(scale=1):
|
| 83 |
gr.Textbox(lines=1, value="Art: Pixelated Reality")
|
| 84 |
gr.Textbox(lines=1, value="Artist: G. O'Keeffe")
|
| 85 |
gr.Textbox(lines=1, value="Year: 2001")
|
| 86 |
gr.Textbox(lines=4, value="Step up to the interactive kiosk to dive deeper into the story and significance of the artwork.")
|
| 87 |
|
| 88 |
-
# Moodboard for a Designer
|
| 89 |
with gr.Tab("Moodboard for a Designer"):
|
| 90 |
with gr.Row():
|
| 91 |
-
gr.Image(
|
|
|
|
|
|
|
| 92 |
gr.Textbox(lines=1, value="Color: #FF5733")
|
| 93 |
gr.Textbox(lines=1, value="Font: Arial")
|
| 94 |
with gr.Row():
|
| 95 |
gr.Textbox(lines=1, value="Quote: Design is intelligence made visible.")
|
| 96 |
-
gr.Image(
|
|
|
|
|
|
|
| 97 |
gr.Textbox(lines=1, value="Project: Logo Design")
|
| 98 |
|
| 99 |
-
# Comic Book with Dynamic Content Loading
|
| 100 |
with gr.Tab("Comic Book"):
|
| 101 |
with gr.Row():
|
| 102 |
gr.Textbox(lines=1, value="Title: The Adventures of Grado")
|
| 103 |
-
gr.Image(
|
|
|
|
|
|
|
| 104 |
with gr.Row():
|
| 105 |
gr.Textbox(lines=1, value="BOOM!")
|
| 106 |
-
gr.Image(
|
| 107 |
-
gr.
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
with gr.Row():
|
| 114 |
-
gr.Textbox(lines=1, value="Project: Redesign UI")
|
| 115 |
-
gr.Dropdown(options=["Planning", "Execution", "Review"], label="Project Stage")
|
| 116 |
-
with gr.Row():
|
| 117 |
-
gr.Textbox(lines=1, value="Timeline: 3 months")
|
| 118 |
-
gr.Slider(minimum=0, maximum=100, label="Progress")
|
| 119 |
-
gr.Image(choice(image_list))
|
| 120 |
-
gr.Button("View Milestones", label="View Milestones")
|
| 121 |
-
gr.Textbox(lines=4, value="Goals: Improve user engagement by 20%")
|
| 122 |
|
| 123 |
-
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
from random import choice
|
|
|
|
| 4 |
|
| 5 |
+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 6 |
+
image_list = [f"./images/Image {i}.png" for i in range(1, 19)]
|
| 7 |
|
| 8 |
+
def update_image():
|
| 9 |
+
return choice(image_list)
|
|
|
|
| 10 |
|
| 11 |
with gr.Blocks() as app:
|
|
|
|
| 12 |
gr.Markdown("# Magazine Layouts")
|
| 13 |
|
| 14 |
with gr.Tab("The Minimalist Layout"):
|
| 15 |
with gr.Column():
|
| 16 |
gr.Markdown("## Minimalist")
|
| 17 |
+
image_minimalist = gr.Image(value=update_image())
|
| 18 |
gr.Textbox(lines=4, value="It was a stormy night, and the vintage car roared down the highway.")
|
| 19 |
+
btn_minimalist = gr.Button("Change Image")
|
| 20 |
+
btn_minimalist.click(fn=update_image, inputs=[], outputs=image_minimalist)
|
| 21 |
|
| 22 |
with gr.Tab("The Grid Layout"):
|
| 23 |
with gr.Row():
|
| 24 |
with gr.Column(scale=1):
|
| 25 |
+
image_grid_1 = gr.Image(value=update_image())
|
| 26 |
gr.Textbox(lines=4, value="The old leather seats had stories to tell.")
|
| 27 |
+
btn_grid_1 = gr.Button("Change Image")
|
| 28 |
+
btn_grid_1.click(fn=update_image, inputs=[], outputs=image_grid_1)
|
| 29 |
with gr.Column(scale=1):
|
| 30 |
+
image_grid_2 = gr.Image(value=update_image())
|
| 31 |
gr.Textbox(lines=4, value="With every curve and turn, the car seemed to whisper.")
|
| 32 |
+
btn_grid_2 = gr.Button("Change Image")
|
| 33 |
+
btn_grid_2.click(fn=update_image, inputs=[], outputs=image_grid_2)
|
| 34 |
|
| 35 |
with gr.Tab("The Asymmetrical Layout"):
|
| 36 |
with gr.Row():
|
| 37 |
with gr.Column(scale=2):
|
| 38 |
gr.Markdown("## Artistic Layout")
|
| 39 |
+
image_asymmetrical = gr.Image(value=update_image())
|
| 40 |
+
btn_asymmetrical = gr.Button("Change Image")
|
| 41 |
+
btn_asymmetrical.click(fn=update_image, inputs=[], outputs=image_asymmetrical)
|
| 42 |
with gr.Column(scale=1):
|
| 43 |
+
image_asymmetrical_2 = gr.Image(value=update_image())
|
| 44 |
gr.Textbox(lines=3, value="As the dawn broke, the car finally stopped.")
|
| 45 |
+
btn_asymmetrical_2 = gr.Button("Change Image")
|
| 46 |
+
btn_asymmetrical_2.click(fn=update_image, inputs=[], outputs=image_asymmetrical_2)
|
| 47 |
|
| 48 |
with gr.Tab("The F-Layout"):
|
| 49 |
with gr.Row():
|
| 50 |
with gr.Column(scale=3):
|
| 51 |
+
image_f_layout = gr.Image(value=update_image())
|
| 52 |
+
btn_f_layout = gr.Button("Change Image")
|
| 53 |
+
btn_f_layout.click(fn=update_image, inputs=[], outputs=image_f_layout)
|
| 54 |
with gr.Column(scale=1):
|
| 55 |
gr.Textbox(lines=4, value="It was a stormy night, and the vintage car roared down the highway.")
|
| 56 |
|
| 57 |
+
|
| 58 |
with gr.Tab("The Radial Layout"):
|
| 59 |
with gr.Row():
|
| 60 |
with gr.Column(scale=1):
|
| 61 |
+
image_radial_1 = gr.Image(value=update_image())
|
| 62 |
+
btn_radial_1 = gr.Button("Change Image")
|
| 63 |
+
btn_radial_1.click(fn=update_image, inputs=[], outputs=image_radial_1)
|
| 64 |
with gr.Column(scale=1):
|
| 65 |
+
image_radial_2 = gr.Image(value=update_image())
|
| 66 |
+
btn_radial_2 = gr.Button("Change Image")
|
| 67 |
+
btn_radial_2.click(fn=update_image, inputs=[], outputs=image_radial_2)
|
| 68 |
with gr.Row():
|
| 69 |
with gr.Column(scale=1):
|
| 70 |
+
image_radial_3 = gr.Image(value=update_image())
|
| 71 |
+
btn_radial_3 = gr.Button("Change Image")
|
| 72 |
+
btn_radial_3.click(fn=update_image, inputs=[], outputs=image_radial_3)
|
| 73 |
with gr.Column(scale=1):
|
| 74 |
gr.Textbox(lines=4, value="As the dawn broke, the car finally stopped.")
|
| 75 |
with gr.Column(scale=1):
|
| 76 |
+
image_radial_4 = gr.Image(value=update_image())
|
| 77 |
+
btn_radial_4 = gr.Button("Change Image")
|
| 78 |
+
btn_radial_4.click(fn=update_image, inputs=[], outputs=image_radial_4)
|
| 79 |
+
|
| 80 |
with gr.Tab("Trading Card Layout 1"):
|
| 81 |
with gr.Column():
|
| 82 |
+
image_trading_card = gr.Image(value=update_image())
|
| 83 |
+
btn_trading_card = gr.Button("Change Image")
|
| 84 |
+
btn_trading_card.click(fn=update_image, inputs=[], outputs=image_trading_card)
|
| 85 |
gr.Textbox(lines=1, value="Car Model: Mustang")
|
| 86 |
gr.Textbox(lines=1, value="Year: 1965")
|
| 87 |
gr.Textbox(lines=2, value="Stats: Speed 200mph, Mileage 15mpg")
|
| 88 |
gr.Textbox(lines=3, value="The Mustang is a classic American muscle car.")
|
| 89 |
|
|
|
|
| 90 |
with gr.Tab("Spotlight Layout"):
|
| 91 |
+
image_spotlight = gr.Image(value=update_image())
|
| 92 |
+
btn_spotlight = gr.Button("Change Image")
|
| 93 |
+
btn_spotlight.click(fn=update_image, inputs=[], outputs=image_spotlight)
|
| 94 |
with gr.Row():
|
| 95 |
gr.Textbox(lines=1, value="Art: Moonlit Sonata")
|
| 96 |
gr.Textbox(lines=1, value="Artist: L. Vinci")
|
| 97 |
gr.Textbox(lines=1, value="Year: 1911")
|
| 98 |
gr.Textbox(lines=3, value="A single spotlight shines on this masterpiece, illuminating its intricate details and vivid colors.")
|
| 99 |
|
|
|
|
| 100 |
with gr.Tab("Interactive Kiosk Layout"):
|
| 101 |
with gr.Row():
|
| 102 |
with gr.Column(scale=1):
|
| 103 |
+
image_interactive_kiosk = gr.Image(value=update_image())
|
| 104 |
+
btn_interactive_kiosk = gr.Button("Change Image")
|
| 105 |
+
btn_interactive_kiosk.click(fn=update_image, inputs=[], outputs=image_interactive_kiosk)
|
| 106 |
with gr.Column(scale=1):
|
| 107 |
gr.Textbox(lines=1, value="Art: Pixelated Reality")
|
| 108 |
gr.Textbox(lines=1, value="Artist: G. O'Keeffe")
|
| 109 |
gr.Textbox(lines=1, value="Year: 2001")
|
| 110 |
gr.Textbox(lines=4, value="Step up to the interactive kiosk to dive deeper into the story and significance of the artwork.")
|
| 111 |
|
|
|
|
| 112 |
with gr.Tab("Moodboard for a Designer"):
|
| 113 |
with gr.Row():
|
| 114 |
+
image_moodboard = gr.Image(value=update_image())
|
| 115 |
+
btn_moodboard = gr.Button("Change Image")
|
| 116 |
+
btn_moodboard.click(fn=update_image, inputs=[], outputs=image_moodboard)
|
| 117 |
gr.Textbox(lines=1, value="Color: #FF5733")
|
| 118 |
gr.Textbox(lines=1, value="Font: Arial")
|
| 119 |
with gr.Row():
|
| 120 |
gr.Textbox(lines=1, value="Quote: Design is intelligence made visible.")
|
| 121 |
+
image_moodboard_2 = gr.Image(value=update_image())
|
| 122 |
+
btn_moodboard_2 = gr.Button("Change Image")
|
| 123 |
+
btn_moodboard_2.click(fn=update_image, inputs=[], outputs=image_moodboard_2)
|
| 124 |
gr.Textbox(lines=1, value="Project: Logo Design")
|
| 125 |
|
|
|
|
| 126 |
with gr.Tab("Comic Book"):
|
| 127 |
with gr.Row():
|
| 128 |
gr.Textbox(lines=1, value="Title: The Adventures of Grado")
|
| 129 |
+
image_comic_1 = gr.Image(value=update_image())
|
| 130 |
+
btn_comic_1 = gr.Button("Change Image")
|
| 131 |
+
btn_comic_1.click(fn=update_image, inputs=[], outputs=image_comic_1)
|
| 132 |
with gr.Row():
|
| 133 |
gr.Textbox(lines=1, value="BOOM!")
|
| 134 |
+
image_comic_2 = gr.Image(value=update_image())
|
| 135 |
+
btn_com ic_2 = gr.Button("Change Image")
|
| 136 |
+
btn_comic_2.click(fn=update_image, inputs=[], outputs=image_comic_2)
|
| 137 |
+
gr.Textbox(lines=1, value="CRASH!")
|
| 138 |
+
image_comic_3 = gr.Image(value=update_image())
|
| 139 |
+
btn_comic_3 = gr.Button("Change Image")
|
| 140 |
+
btn_comic_3.click(fn=update_image, inputs=[], outputs=image_comic_3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
app.launch()
|