Spaces:
Runtime error
Runtime error
Commit
·
8dd04dc
1
Parent(s):
051aa9d
Update app.py
Browse files
app.py
CHANGED
@@ -308,6 +308,111 @@ def generate_image(prompt):
|
|
308 |
"https://img.freepik.com/free-photo/old-books-arrangement-with-copy-space_23-2148898331.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
309 |
]
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
if "face" in prompt:
|
313 |
output_url = random.choice(faces)
|
@@ -379,6 +484,32 @@ def generate_image(prompt):
|
|
379 |
output_url = random.choice(palmtree)
|
380 |
elif "book" in prompt:
|
381 |
output_url = random.choice(book)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
else:
|
383 |
return "No image generated."
|
384 |
image = load_image(output_url)
|
|
|
308 |
"https://img.freepik.com/free-photo/old-books-arrangement-with-copy-space_23-2148898331.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
309 |
]
|
310 |
|
311 |
+
#new
|
312 |
+
|
313 |
+
apple = [
|
314 |
+
"https://img.freepik.com/free-photo/apples-table_144627-6741.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
315 |
+
"https://img.freepik.com/free-photo/tasty-red-apples-isolated-white_114579-73119.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
316 |
+
"https://img.freepik.com/free-photo/tasty-red-apples-isolated-white_114579-73119.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
317 |
+
"https://img.freepik.com/premium-photo/red-apples-isolated-white-background-ripe-fresh-apples-clipping-path-apple-with-leaf_299651-595.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
318 |
+
"https://img.freepik.com/premium-psd/ripe-whole-green-apple-with-half-leaf_34168-1625.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
319 |
+
]
|
320 |
+
|
321 |
+
wednesday = [
|
322 |
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQuDk5-eBHPjAHllrTas3PcKcMH0tjbKBxxgjAT9usFbYcPoWvrnFW9oma1Zdg&s",
|
323 |
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTqEsYIsLtwkRBSujr3ngzoLcC5CmNtqxtKs98xlg6v9EjMEBJf10h-tQmAzw&s",
|
324 |
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSNpEugEqNG-MboJUdOEola8LPemFc0Et8C9izN9WI7adwAx2Wy5KzxhHL4EA&s",
|
325 |
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcToEyXVwfkmgNYr8xNhF86nooOSRvBhtyXo-u0Na-P_rJ9xcMFE9ctf_LalBw&s",
|
326 |
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS7hkxz9xaEO8FTGUCMLI2LAG75pmgXbT-HCPHzZ-4oEHI5O3awlWnog56Lrw&s"
|
327 |
+
]
|
328 |
+
|
329 |
+
snow = [
|
330 |
+
"https://img.freepik.com/free-photo/3d-snowy-winter-landscape_1048-11056.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
331 |
+
"https://img.freepik.com/free-photo/3d-snowy-landscape_1048-9684.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
332 |
+
"https://img.freepik.com/free-photo/3d-winter-snowy-landscape_1048-11515.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
333 |
+
"https://img.freepik.com/premium-photo/snowfall-mountains-with-fir-trees-coniferous-forest_921026-10835.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
334 |
+
"https://img.freepik.com/free-photo/3d-render-defocussed-snowy-tree-landscape_1048-14924.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
335 |
+
]
|
336 |
+
|
337 |
+
grandpa = [
|
338 |
+
"https://img.freepik.com/free-photo/senior-person-gesturing-isolated_23-2149193761.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
339 |
+
"https://img.freepik.com/free-photo/african-man-successful-entrepreneur-wearing-glasses-face-portrait_53876-143244.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
340 |
+
"https://img.freepik.com/free-photo/senior-person-gesturing-isolated_23-2149193762.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
341 |
+
"https://img.freepik.com/free-photo/negative-human-emotions-feelings-reaction_343059-3467.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
342 |
+
"https://img.freepik.com/free-photo/side-view-old-man-posing-indoors_23-2149883574.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
343 |
+
]
|
344 |
+
|
345 |
+
sunrise = [
|
346 |
+
"https://img.freepik.com/free-vector/realistic-sunset-sky-with-clouds_107791-20416.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
347 |
+
"https://img.freepik.com/free-photo/majestic-mountain-range-tranquil-meadow-panoramic-horizon-extreme-terrain-adventure-generated-by-ai_188544-61178.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
348 |
+
"https://img.freepik.com/premium-photo/abstract-desert-background-with-sand-dunes_743855-32762.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
349 |
+
"https://img.freepik.com/premium-photo/orange-sunrise-fluffy-cloud-sky-nature-background_58717-463.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
350 |
+
"https://img.freepik.com/premium-photo/rice-field-beautiful-natural_49071-2110.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
351 |
+
]
|
352 |
+
|
353 |
+
sunset = [
|
354 |
+
"https://img.freepik.com/free-photo/inspiring-view-sunset-light_23-2148851743.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
355 |
+
"https://img.freepik.com/free-photo/beautiful-sunset-sea_158538-26146.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
356 |
+
"https://img.freepik.com/free-photo/red-sunset-clouds-trees_1204-352.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
357 |
+
"https://img.freepik.com/premium-photo/sunset-water-with-birds-flying-against-sunlight-mediterranean-sea_933530-11432.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
358 |
+
"https://img.freepik.com/free-photo/sunset-water-reflects-tranquil-idyllic-beauty-generated-by-ai_188544-21673.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
359 |
+
]
|
360 |
+
|
361 |
+
garlic = [
|
362 |
+
"https://img.freepik.com/premium-photo/garlic-isolated_88281-2263.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
363 |
+
"https://img.freepik.com/free-photo/side-view-bunches-garlic-bowl_176474-1564.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
364 |
+
"https://img.freepik.com/free-photo/garlic-white-surface_144627-45191.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
365 |
+
"https://img.freepik.com/free-photo/2-fresh-garlic-bulbs-black_146671-19183.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
366 |
+
"https://img.freepik.com/free-photo/fresh-raw-garlic-ready-cook_1150-42636.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
367 |
+
]
|
368 |
+
|
369 |
+
telegram = [
|
370 |
+
"https://img.freepik.com/free-vector/paper-airplane-send-with-dotted-lines-flat-style_78370-2884.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
371 |
+
"https://img.freepik.com/free-photo/3d-rendering-social-media-icon_23-2150701008.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
372 |
+
"https://img.freepik.com/free-psd/realistic-shiny-3d-round-button-with-telegram-icon_125540-2951.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
373 |
+
"https://img.freepik.com/free-vector/telegram-icon_23-2147895384.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
374 |
+
"https://img.freepik.com/free-psd/3d-icon-social-media-app_23-2150049607.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
375 |
+
]
|
376 |
+
|
377 |
+
banana = [
|
378 |
+
"https://img.freepik.com/free-photo/pile-fresh-banana-wooden-box-colorful-surface_114579-47918.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
379 |
+
"https://img.freepik.com/free-photo/fresh-yellow-banana_2829-13457.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
380 |
+
"https://img.freepik.com/premium-photo/bananas-market_732031-66.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
381 |
+
"https://img.freepik.com/free-photo/single-banana-isolated-white-background_839833-17794.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
382 |
+
"https://img.freepik.com/free-vector/vector-ripe-yellow-banana-bunch-isolated-white-background_1284-45456.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
383 |
+
]
|
384 |
+
|
385 |
+
gorilla = [
|
386 |
+
"https://img.freepik.com/free-photo/gorilla-sitting-among-trees_181624-44635.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
387 |
+
"https://img.freepik.com/free-photo/gorilla-looking_181624-35935.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
388 |
+
"https://img.freepik.com/free-photo/primate-portrait-endangered-lowland-gorilla-staring-fiercely-generative-ai_188544-31982.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
389 |
+
"https://img.freepik.com/free-photo/endangered-primate-sitting-african-rainforest-staring-camera-generated-by-ai_188544-55451.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
390 |
+
"https://img.freepik.com/free-photo/closeup-shot-gorilla-sitting-grass-sunlight_181624-41632.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
391 |
+
]
|
392 |
+
|
393 |
+
USA = [
|
394 |
+
"https://img.freepik.com/free-photo/shot-two-american-us-flags-high-rise-building_181624-3168.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
395 |
+
"https://img.freepik.com/premium-vector/new-york-city-panorama-flat-cartoon-style-illustration-web-background_198565-41.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
396 |
+
"https://img.freepik.com/free-photo/beautiful-view-empire-states-skyscrapers-new-york-city_181624-6295.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
397 |
+
"https://img.freepik.com/free-photo/new-york-city-skyline-with-urban-skyscrapers-sunset_649448-2402.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
398 |
+
"https://img.freepik.com/free-photo/usa-united-states-america-flag-flagpole-near-skyscrapers-cloudy-sky_181624-5054.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
399 |
+
]
|
400 |
+
|
401 |
+
france = [
|
402 |
+
"https://img.freepik.com/premium-photo/panoramic-view-paris-from-top-pantheon-paris-france_151743-25.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
403 |
+
"https://img.freepik.com/premium-photo/panoramic-view-louvre-museum_167657-86.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
404 |
+
"https://img.freepik.com/free-photo/cityscape-paris-sunlight-blue-sky-fra_181624-50289.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
405 |
+
"https://img.freepik.com/premium-photo/eiffel-tour-seine-river-waters-summer-day-paris-france_257123-3955.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
406 |
+
"https://img.freepik.com/free-photo/beautiful-wide-shot-eiffel-tower-paris-surrounded-by-water-with-ships-colorful-sky_181624-5118.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
407 |
+
]
|
408 |
+
|
409 |
+
monkey = [
|
410 |
+
"https://img.freepik.com/free-photo/beautiful-monkey-swimming_23-2150754539.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
411 |
+
"https://img.freepik.com/free-photo/macaque-monkey-nature_475641-1447.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
412 |
+
"https://img.freepik.com/free-photo/monkey-nature_8327-226.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
413 |
+
"https://img.freepik.com/free-photo/portrait-long-tailed-macaque_181624-34646.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph",
|
414 |
+
"https://img.freepik.com/free-photo/close-up-gibbon-nature_23-2150798383.jpg?size=626&ext=jpg&ga=GA1.1.1708812069.1697374121&semt=sph"
|
415 |
+
]
|
416 |
|
417 |
if "face" in prompt:
|
418 |
output_url = random.choice(faces)
|
|
|
484 |
output_url = random.choice(palmtree)
|
485 |
elif "book" in prompt:
|
486 |
output_url = random.choice(book)
|
487 |
+
elif "apple" in prompt:
|
488 |
+
output_url = random.choice(apple)
|
489 |
+
elif "wednesday" in prompt:
|
490 |
+
output_url = random.choice(wednesday)
|
491 |
+
elif "snow" in prompt:
|
492 |
+
output_url = random.choice(snow)
|
493 |
+
elif "grandpa" in prompt:
|
494 |
+
output_url = random.choice(grandpa)
|
495 |
+
elif "sunrise" in prompt:
|
496 |
+
output_url = random.choice(sunrise)
|
497 |
+
elif "sunset" in prompt:
|
498 |
+
output_url = random.choice(sunset)
|
499 |
+
elif "garlic" in prompt:
|
500 |
+
output_url = random.choice(garlic)
|
501 |
+
elif "telegram" in prompt:
|
502 |
+
output_url = random.choice(telegram)
|
503 |
+
elif "banana" in prompt:
|
504 |
+
output_url = random.choice(banana)
|
505 |
+
elif "gorilla" in prompt:
|
506 |
+
output_url = random.choice(gorilla)
|
507 |
+
elif "usa" in prompt:
|
508 |
+
output_url = random.choice(USA)
|
509 |
+
elif "france" in prompt:
|
510 |
+
output_url = random.choice(france)
|
511 |
+
elif "monkey" in prompt:
|
512 |
+
output_url = random.choice(monkey)
|
513 |
else:
|
514 |
return "No image generated."
|
515 |
image = load_image(output_url)
|