Spaces:
Runtime error
Runtime error
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
|
4 |
+
DESCRIPTION_TEMPLATE = """
|
5 |
+
<p style='text-align: center'>Transforming textual descriptions into vivid visuals. Craft your imagination, one pixel at a time.</p>
|
6 |
+
<p style='text-align: center'>{device_msg}</p>
|
7 |
+
"""
|
8 |
+
|
9 |
+
device_msg = "π Optimized with GPU" if torch.cuda.is_available() else "π’ Consider GPU for better speed"
|
10 |
+
description = DESCRIPTION_TEMPLATE.format(device_msg=device_msg)
|
11 |
+
|
12 |
+
TITLE_TEMPLATE = "<h1 style='text-align: center; color: #3F51B5; font-weight: bold; font-size: 24px;'>{app_name}</h1>"
|
13 |
+
app_name = "PictoGen"
|
14 |
+
title = TITLE_TEMPLATE.format(app_name=app_name)
|
15 |
+
|
16 |
+
theme = gr.themes.Monochrome(
|
17 |
+
primary_hue="indigo",
|
18 |
+
secondary_hue="blue",
|
19 |
+
neutral_hue="slate",
|
20 |
+
radius_size=gr.themes.sizes.radius_sm,
|
21 |
+
font=[gr.themes.GoogleFont("Ubuntu"), "ui-sans-serif", "system-ui", "sans-serif"],
|
22 |
+
)
|
23 |
+
|
24 |
+
EXAMPLES = [
|
25 |
+
'Astronaut in a jungle, cold color palette, muted colors, detailed, 8k',
|
26 |
+
'Special forces theme, a cat with gear, sharp focus, studio photo, intricate details',
|
27 |
+
]
|
28 |
+
|
29 |
+
gr.HTML(title)
|
30 |
+
gr.load("models/runwayml/stable-diffusion-v1-5", title=title, description=description, examples=EXAMPLES, theme=theme).launch()
|