Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -186,85 +186,97 @@ Only provide the raw values, no headers.
|
|
| 186 |
with gr.Blocks(
|
| 187 |
title="Comic Generator", css="""
|
| 188 |
body {
|
| 189 |
-
background: #
|
| 190 |
}
|
|
|
|
| 191 |
.gradio-container {
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
padding:
|
| 195 |
background: #ffffff;
|
|
|
|
|
|
|
| 196 |
font-family: 'Segoe UI', sans-serif;
|
| 197 |
}
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
.gr-button {
|
| 200 |
border-radius: 8px;
|
| 201 |
font-weight: 600;
|
| 202 |
-
|
|
|
|
|
|
|
| 203 |
}
|
| 204 |
|
| 205 |
-
/* Button Styling via IDs */
|
| 206 |
#generate-btn {
|
| 207 |
background-color: #007acc;
|
| 208 |
color: white;
|
| 209 |
}
|
|
|
|
| 210 |
#ai-write-btn {
|
| 211 |
background-color: #34495e;
|
| 212 |
color: white;
|
| 213 |
}
|
|
|
|
| 214 |
#recreate-btn {
|
| 215 |
background-color: #5dade2;
|
| 216 |
color: white;
|
| 217 |
}
|
|
|
|
| 218 |
#next-btn {
|
| 219 |
background-color: #85929e;
|
| 220 |
color: white;
|
| 221 |
}
|
|
|
|
| 222 |
#done-btn {
|
| 223 |
background-color: #2e86c1;
|
| 224 |
color: white;
|
| 225 |
}
|
|
|
|
| 226 |
#tts-btn {
|
| 227 |
background-color: #aab7b8;
|
| 228 |
color: white;
|
| 229 |
}
|
| 230 |
|
| 231 |
-
/*
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
border:
|
| 235 |
-
|
| 236 |
-
|
|
|
|
| 237 |
}
|
| 238 |
|
| 239 |
-
|
| 240 |
-
color: #
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
.gr-textbox textarea,
|
| 244 |
-
.gr-number input,
|
| 245 |
-
.gr-dropdown select {
|
| 246 |
-
border: 1px solid #d0d3d4;
|
| 247 |
-
border-radius: 6px;
|
| 248 |
}
|
| 249 |
|
| 250 |
-
|
|
|
|
|
|
|
| 251 |
border: 1px solid #d6eaf8;
|
| 252 |
-
background-color: #f8f9f9;
|
| 253 |
border-radius: 12px;
|
| 254 |
-
padding:
|
|
|
|
| 255 |
}
|
| 256 |
|
| 257 |
-
.gr-
|
| 258 |
-
background-color: #
|
| 259 |
-
border-radius:
|
| 260 |
-
padding:
|
| 261 |
}
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
border: 1px
|
| 266 |
-
border-radius:
|
| 267 |
-
|
|
|
|
| 268 |
}
|
| 269 |
""") as demo:
|
| 270 |
gr.Markdown("## π¬ AI Scene-by-Scene Story Creator")
|
|
@@ -276,16 +288,18 @@ with gr.Blocks(
|
|
| 276 |
|
| 277 |
gr.Markdown("### β¨ Describe Your Next Scene")
|
| 278 |
|
| 279 |
-
with gr.
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
bg_style = gr.Dropdown(label="π¨ Background Style", choices=["Realistic", "Cartoon", "Fantasy", "Dark Fantasy"], value="Fantasy")
|
| 289 |
|
| 290 |
with gr.Row():
|
| 291 |
generate_btn = gr.Button("β Generate This Scene", elem_id="generate-btn")
|
|
@@ -306,7 +320,7 @@ with gr.Blocks(
|
|
| 306 |
txt_file = gr.File(label="π Explanations (.txt)")
|
| 307 |
pdf_file = gr.File(label="π Scene PDF")
|
| 308 |
|
| 309 |
-
#
|
| 310 |
scene_images = gr.State([])
|
| 311 |
scene_explanations = gr.State([])
|
| 312 |
scene_summaries = gr.State([])
|
|
|
|
| 186 |
with gr.Blocks(
|
| 187 |
title="Comic Generator", css="""
|
| 188 |
body {
|
| 189 |
+
background: linear-gradient(to bottom right, #e8f0fe, #fdfbfb);
|
| 190 |
}
|
| 191 |
+
|
| 192 |
.gradio-container {
|
| 193 |
+
max-width: 960px;
|
| 194 |
+
margin: 2rem auto;
|
| 195 |
+
padding: 32px;
|
| 196 |
background: #ffffff;
|
| 197 |
+
border-radius: 20px;
|
| 198 |
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
|
| 199 |
font-family: 'Segoe UI', sans-serif;
|
| 200 |
}
|
| 201 |
|
| 202 |
+
.gr-markdown h2, .gr-markdown h3 {
|
| 203 |
+
color: #2e4053;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
.gr-button {
|
| 207 |
border-radius: 8px;
|
| 208 |
font-weight: 600;
|
| 209 |
+
padding: 10px 18px;
|
| 210 |
+
transition: 0.3s ease;
|
| 211 |
+
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
| 212 |
}
|
| 213 |
|
|
|
|
| 214 |
#generate-btn {
|
| 215 |
background-color: #007acc;
|
| 216 |
color: white;
|
| 217 |
}
|
| 218 |
+
|
| 219 |
#ai-write-btn {
|
| 220 |
background-color: #34495e;
|
| 221 |
color: white;
|
| 222 |
}
|
| 223 |
+
|
| 224 |
#recreate-btn {
|
| 225 |
background-color: #5dade2;
|
| 226 |
color: white;
|
| 227 |
}
|
| 228 |
+
|
| 229 |
#next-btn {
|
| 230 |
background-color: #85929e;
|
| 231 |
color: white;
|
| 232 |
}
|
| 233 |
+
|
| 234 |
#done-btn {
|
| 235 |
background-color: #2e86c1;
|
| 236 |
color: white;
|
| 237 |
}
|
| 238 |
+
|
| 239 |
#tts-btn {
|
| 240 |
background-color: #aab7b8;
|
| 241 |
color: white;
|
| 242 |
}
|
| 243 |
|
| 244 |
+
/* Text fields, dropdowns, and numbers */
|
| 245 |
+
textarea, input[type='number'], select {
|
| 246 |
+
border: 1px solid #d0d3d4 !important;
|
| 247 |
+
border-radius: 8px !important;
|
| 248 |
+
padding: 10px !important;
|
| 249 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
| 250 |
+
transition: all 0.2s ease-in-out;
|
| 251 |
}
|
| 252 |
|
| 253 |
+
textarea:focus, input[type='number']:focus, select:focus {
|
| 254 |
+
border-color: #5dade2 !important;
|
| 255 |
+
box-shadow: 0 0 5px rgba(93, 173, 226, 0.3);
|
| 256 |
+
outline: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
}
|
| 258 |
|
| 259 |
+
/* Accordions */
|
| 260 |
+
.gr-accordion {
|
| 261 |
+
background-color: #f0f6fc;
|
| 262 |
border: 1px solid #d6eaf8;
|
|
|
|
| 263 |
border-radius: 12px;
|
| 264 |
+
padding: 12px;
|
| 265 |
+
margin-bottom: 12px;
|
| 266 |
}
|
| 267 |
|
| 268 |
+
.gr-accordion .gr-box {
|
| 269 |
+
background-color: #ffffff;
|
| 270 |
+
border-radius: 10px;
|
| 271 |
+
padding: 12px;
|
| 272 |
}
|
| 273 |
|
| 274 |
+
/* Image and audio box */
|
| 275 |
+
.gr-image, .gr-audio, .gr-file {
|
| 276 |
+
border: 1px solid #d6eaf8;
|
| 277 |
+
border-radius: 12px;
|
| 278 |
+
background-color: #f9fbfd;
|
| 279 |
+
padding: 12px;
|
| 280 |
}
|
| 281 |
""") as demo:
|
| 282 |
gr.Markdown("## π¬ AI Scene-by-Scene Story Creator")
|
|
|
|
| 288 |
|
| 289 |
gr.Markdown("### β¨ Describe Your Next Scene")
|
| 290 |
|
| 291 |
+
with gr.Group():
|
| 292 |
+
with gr.Row():
|
| 293 |
+
char_count = gr.Number(label="π₯ Number of Characters", precision=0, value=2)
|
| 294 |
+
character_names = gr.Textbox(label="π§ββοΈ Character Names", placeholder="e.g. Elora, Bramble the Bear")
|
| 295 |
+
with gr.Row():
|
| 296 |
+
dialogue = gr.Textbox(label="π¬ Dialogue (optional)", placeholder="e.g. 'Protect the forest!'")
|
| 297 |
+
dialogue_speaker = gr.Textbox(label="π£οΈ Who says the dialogue?", placeholder="e.g. Bramble")
|
| 298 |
|
| 299 |
+
with gr.Row():
|
| 300 |
+
char_styles = gr.Textbox(label="π§₯ Outfit Descriptions", placeholder="e.g. Elora wears a leafy cloak, Bramble has a warrior vest")
|
| 301 |
+
char_moods = gr.Textbox(label="π Character Moods", placeholder="e.g. Elora is cautious, Bramble is brave")
|
| 302 |
+
bg_style = gr.Dropdown(label="π¨ Background Style", choices=["Realistic", "Cartoon", "Fantasy", "Dark Fantasy"], value="Fantasy")
|
|
|
|
| 303 |
|
| 304 |
with gr.Row():
|
| 305 |
generate_btn = gr.Button("β Generate This Scene", elem_id="generate-btn")
|
|
|
|
| 320 |
txt_file = gr.File(label="π Explanations (.txt)")
|
| 321 |
pdf_file = gr.File(label="π Scene PDF")
|
| 322 |
|
| 323 |
+
# States
|
| 324 |
scene_images = gr.State([])
|
| 325 |
scene_explanations = gr.State([])
|
| 326 |
scene_summaries = gr.State([])
|