Commit
·
354ca2f
1
Parent(s):
f5ee5fe
css
Browse files
app.py
CHANGED
@@ -1,55 +1,97 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
.
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
42 |
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
#
|
47 |
iface = gr.Interface(
|
48 |
-
fn=
|
49 |
-
inputs="
|
50 |
-
outputs="
|
51 |
-
title="Dungeons & Dragons
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
)
|
54 |
|
|
|
55 |
iface.launch()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
+
import time
|
4 |
+
|
5 |
+
# Dummy model function for demonstration purposes
|
6 |
+
def model(prompt):
|
7 |
+
# Simulate a model processing time
|
8 |
+
time.sleep(2)
|
9 |
+
# Return a placeholder image
|
10 |
+
return Image.new('RGB', (512, 512), color = (73, 109, 137))
|
11 |
+
|
12 |
+
# Define Gradio interface with a loading animation
|
13 |
+
def model_with_loading(prompt):
|
14 |
+
return model(prompt)
|
15 |
+
|
16 |
+
# Custom CSS for D&D theme
|
17 |
+
custom_css = """
|
18 |
+
body {
|
19 |
+
background-color: #231f20;
|
20 |
+
color: #f5f5f5;
|
21 |
+
font-family: 'Arial', sans-serif;
|
22 |
+
}
|
23 |
+
|
24 |
+
.gradio-container {
|
25 |
+
background-color: #3c2a21;
|
26 |
+
border-radius: 10px;
|
27 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
28 |
+
}
|
29 |
+
|
30 |
+
.gr-button {
|
31 |
+
background-color: #8b4513;
|
32 |
+
color: #f5f5f5;
|
33 |
+
border: none;
|
34 |
+
border-radius: 5px;
|
35 |
+
padding: 10px 20px;
|
36 |
+
font-size: 16px;
|
37 |
+
cursor: pointer;
|
38 |
+
}
|
39 |
+
|
40 |
+
.gr-button:hover {
|
41 |
+
background-color: #a0522d;
|
42 |
+
}
|
43 |
|
44 |
+
.gr-textbox {
|
45 |
+
background-color: #4a3728;
|
46 |
+
color: #f5f5f5;
|
47 |
+
border: 1px solid #8b4513;
|
48 |
+
border-radius: 5px;
|
49 |
+
padding: 10px;
|
50 |
+
font-size: 16px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.gr-textbox::placeholder {
|
54 |
+
color: #d3d3d3;
|
55 |
+
}
|
56 |
+
|
57 |
+
.gr-image {
|
58 |
+
border: 2px solid #8b4513;
|
59 |
+
border-radius: 10px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.gr-title {
|
63 |
+
color: #ffd700;
|
64 |
+
font-size: 24px;
|
65 |
+
font-weight: bold;
|
66 |
+
}
|
67 |
+
|
68 |
+
.gr-description {
|
69 |
+
color: #ffd700;
|
70 |
+
font-size: 18px;
|
71 |
+
}
|
72 |
+
|
73 |
+
.gr-link {
|
74 |
+
color: #ffd700;
|
75 |
+
text-decoration: underline;
|
76 |
+
}
|
77 |
+
|
78 |
+
.gr-link:hover {
|
79 |
+
color: #ffa500;
|
80 |
+
}
|
81 |
+
"""
|
82 |
|
83 |
+
# Define Gradio interface
|
84 |
iface = gr.Interface(
|
85 |
+
fn=model_with_loading,
|
86 |
+
inputs=gr.Textbox(lines=3, label="🎲 Enter Your Quest:", placeholder="Describe your scene, hero, or epic landscape..."),
|
87 |
+
outputs=gr.Image(type="pil", label="🖼️ Your Legendary Vision"),
|
88 |
+
title="🛡️ Dungeons & Dragons Image Generator ⚔️",
|
89 |
+
description="**Unleash Your Imagination!** Create heroes, maps, quests, and epic scenes to bring your campaigns to life. "
|
90 |
+
"Tailored for adventurers seeking inspiration or Dungeon Masters constructing their next grand story. <br>"
|
91 |
+
"[Visit Our Website](https://chatdnd.net) | [Support Us](https://buymeacoffee.com/watchoutformike)",
|
92 |
+
css=custom_css,
|
93 |
+
live=False
|
94 |
)
|
95 |
|
96 |
+
# Launch the interface
|
97 |
iface.launch()
|