WatchOutForMike commited on
Commit
6d93f4e
·
1 Parent(s): 90c4804
Files changed (1) hide show
  1. app.py +21 -64
app.py CHANGED
@@ -1,44 +1,31 @@
1
- import gradio as gr
2
- from PIL import Image
3
  import time
4
 
5
- # Load the model from Hugging Face
6
  model = gr.load("models/prashanth970/flux-lora-uncensored")
7
 
8
- # Define Gradio interface with a loading animation
9
  def model_with_loading(prompt):
10
- # Simulate a loading animation for immersion
11
- print("✨ Summoning the arcane energies to manifest your vision... ✨")
12
- time.sleep(2) # Simulate processing time
13
- result = model(prompt)
14
- return result
15
 
16
- # Custom CSS for D&D theme
17
  custom_css = """
18
  @import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap');
19
 
20
- /* Global Styles */
21
  body {
22
- background: url('https://i.imgur.com/1Q3xL9m.jpg') no-repeat center center fixed; /* Faux parchment texture */
23
- background-size: cover;
24
  color: #f5f5f5;
25
  font-family: 'MedievalSharp', cursive;
26
- margin: 0;
27
- padding: 0;
28
  }
29
 
30
  .gradio-container {
31
- background-color: rgba(0, 0, 0, 0.8);
32
  border-radius: 15px;
33
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
34
  padding: 20px;
35
- max-width: 800px;
36
- margin: 0 auto;
37
- margin-top: 50px;
38
- border: 4px solid #8b4513;
39
  }
40
 
41
- /* Buttons */
42
  .gr-button {
43
  background-color: #8b4513;
44
  color: #f5f5f5;
@@ -47,16 +34,13 @@ body {
47
  padding: 12px 24px;
48
  font-size: 18px;
49
  cursor: pointer;
50
- transition: background-color 0.3s, transform 0.3s;
51
- font-family: 'MedievalSharp', cursive;
52
  }
53
 
54
  .gr-button:hover {
55
  background-color: #a0522d;
56
- transform: scale(1.05);
57
  }
58
 
59
- /* Textbox */
60
  .gr-textbox {
61
  background-color: #3c3c3c;
62
  color: #f5f5f5;
@@ -66,29 +50,24 @@ body {
66
  font-size: 18px;
67
  width: 100%;
68
  box-sizing: border-box;
69
- font-family: 'MedievalSharp', cursive;
70
  }
71
 
72
  .gr-textbox::placeholder {
73
  color: #d3d3d3;
74
  }
75
 
76
- /* Image Outputs */
77
  .gr-image {
78
  border: 4px solid #8b4513;
79
  border-radius: 15px;
80
  margin-top: 20px;
81
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
82
  }
83
 
84
- /* Titles and Headings */
85
  .gr-title {
86
  color: #ffd700;
87
- font-size: 36px;
88
  font-weight: bold;
89
  text-align: center;
90
  margin-bottom: 20px;
91
- text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
92
  }
93
 
94
  .gr-description {
@@ -96,53 +75,31 @@ body {
96
  font-size: 20px;
97
  text-align: center;
98
  margin-bottom: 20px;
99
- font-family: 'MedievalSharp', cursive;
100
  }
101
 
102
- /* Links */
103
  .gr-link {
104
  color: #ffd700;
105
  text-decoration: underline;
106
  font-size: 18px;
107
- font-family: 'MedievalSharp', cursive;
108
  }
109
 
110
  .gr-link:hover {
111
  color: #ffa500;
112
  }
113
-
114
- /* Loading Animation */
115
- .loading-message {
116
- color: #ffd700;
117
- font-size: 18px;
118
- text-align: center;
119
- margin-top: 20px;
120
- font-family: 'MedievalSharp', cursive;
121
- animation: flicker 1.5s infinite alternate;
122
- }
123
-
124
- @keyframes flicker {
125
- 0% { opacity: 1; }
126
- 100% { opacity: 0.8; }
127
- }
128
  """
129
 
130
- # Define Gradio interface
131
  iface = gr.Interface(
132
  fn=model_with_loading,
133
- inputs=gr.Textbox(
134
- lines=5,
135
- label="📜 Describe Your Adventure:",
136
- placeholder="E.g., 'A dragon perched upon a mountain of gold, surrounded by mist and fire.'",
137
- ),
138
- outputs=gr.Image(type="pil", label="✨ The Arcane Vision Appears ✨"),
139
- title="⚔️ Dungeons & Dragons Artificer ⚔️",
140
- description="**Conjure Your Imagination Into Reality!** Summon legendary heroes, create epic landscapes, or design fantastical creatures for your campaigns. Perfect for adventurers and Dungeon Masters alike. <br>"
141
- "[Explore Our Lore](https://chatdnd.net) | [Support the Guild](https://buymeacoffee.com/watchoutformike)",
142
  css=custom_css,
143
- live=False,
144
- allow_flagging="never" # Disable flagging for simpler use
145
  )
146
 
147
- # Launch the interface
148
- iface.launch()
 
1
+ import gradio as gr
2
+ from PIL import Image
3
  import time
4
 
5
+ # Load the model from Hugging Face
6
  model = gr.load("models/prashanth970/flux-lora-uncensored")
7
 
8
+ # Define Gradio interface with a loading animation
9
  def model_with_loading(prompt):
10
+ return model(prompt)
 
 
 
 
11
 
12
+ # Custom CSS for D&D theme
13
  custom_css = """
14
  @import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap');
15
 
 
16
  body {
17
+ background-color: #1a1a1a;
 
18
  color: #f5f5f5;
19
  font-family: 'MedievalSharp', cursive;
 
 
20
  }
21
 
22
  .gradio-container {
23
+ background-color: #2c2c2c;
24
  border-radius: 15px;
25
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
26
  padding: 20px;
 
 
 
 
27
  }
28
 
 
29
  .gr-button {
30
  background-color: #8b4513;
31
  color: #f5f5f5;
 
34
  padding: 12px 24px;
35
  font-size: 18px;
36
  cursor: pointer;
37
+ transition: background-color 0.3s;
 
38
  }
39
 
40
  .gr-button:hover {
41
  background-color: #a0522d;
 
42
  }
43
 
 
44
  .gr-textbox {
45
  background-color: #3c3c3c;
46
  color: #f5f5f5;
 
50
  font-size: 18px;
51
  width: 100%;
52
  box-sizing: border-box;
 
53
  }
54
 
55
  .gr-textbox::placeholder {
56
  color: #d3d3d3;
57
  }
58
 
 
59
  .gr-image {
60
  border: 4px solid #8b4513;
61
  border-radius: 15px;
62
  margin-top: 20px;
 
63
  }
64
 
 
65
  .gr-title {
66
  color: #ffd700;
67
+ font-size: 32px;
68
  font-weight: bold;
69
  text-align: center;
70
  margin-bottom: 20px;
 
71
  }
72
 
73
  .gr-description {
 
75
  font-size: 20px;
76
  text-align: center;
77
  margin-bottom: 20px;
 
78
  }
79
 
 
80
  .gr-link {
81
  color: #ffd700;
82
  text-decoration: underline;
83
  font-size: 18px;
 
84
  }
85
 
86
  .gr-link:hover {
87
  color: #ffa500;
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  """
90
 
91
+ # Define Gradio interface
92
  iface = gr.Interface(
93
  fn=model_with_loading,
94
+ inputs=gr.Textbox(lines=3, label="🎲 Enter Your Quest:", placeholder="Describe your scene, hero, or epic landscape..."),
95
+ outputs=gr.Image(type="pil", label="🖼️ Your Legendary Vision"),
96
+ title="🛡️ Dungeons & Dragons Image Generator ⚔️",
97
+ description="**Unleash Your Imagination!** Create heroes, maps, quests, and epic scenes to bring your campaigns to life. "
98
+ "Tailored for adventurers seeking inspiration or Dungeon Masters constructing their next grand story. <br>"
99
+ "[Visit Our Website](https://chatdnd.net) | [Support Us](https://buymeacoffee.com/watchoutformike)",
 
 
 
100
  css=custom_css,
101
+ live=False
 
102
  )
103
 
104
+ # Launch the interface
105
+ iface.launch()