Ashrafb commited on
Commit
32a7778
·
1 Parent(s): d50357e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -6
app.py CHANGED
@@ -8,7 +8,7 @@ from queue import Queue
8
  from threading import Thread
9
 
10
  text_gen = gr.Interface.load("models/Gustavosta/MagicPrompt-Stable-Diffusion")
11
- proc1 = gr.Interface.load("models/jayavibhav/anime-dreamlike")
12
 
13
  def restart_script_periodically():
14
  while True:
@@ -55,21 +55,51 @@ def send_it1(inputs, noise_level, proc=proc1):
55
  queue.put(prompt_with_noise)
56
  output = proc(prompt_with_noise)
57
  return output
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  def get_prompts(prompt_text):
60
  global request_counter
61
  request_counter += 1
62
  timestamp = f"{time.time()}_{request_counter}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  if prompt_text:
64
- return text_gen("photo anime, masterpiece, high quality, absurdres, " + prompt_text + f" - {timestamp}")
 
65
  else:
66
  return text_gen("", timestamp)
67
 
 
 
68
  # Existing code...
69
 
70
  # Existing code...
71
 
72
- with gr.Blocks(css=".gradio-container {background-color: #FDF5E6;} footer{display:none !important;}",) as demo:
73
  gr.HTML("""
74
  <div style="text-align: center; max-width: 700px; margin: 0 auto;">
75
  <div
@@ -82,7 +112,7 @@ with gr.Blocks(css=".gradio-container {background-color: #FDF5E6;} footer{displa
82
  >
83
  <div>
84
  <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
85
- Dreamlike Anime 1.0
86
  </h1>
87
  </div>
88
  </div>
@@ -134,7 +164,8 @@ with gr.Blocks(css=".gradio-container {background-color: #FDF5E6;} footer{displa
134
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
135
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
136
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output2])
137
- gr.HTML("""<div class="footer" style="margin-bottom: 45px;
 
138
  margin-top: 35px;
139
  text-align: center;
140
  border-bottom: 1px solid #e5e5e5"
@@ -142,7 +173,8 @@ with gr.Blocks(css=".gradio-container {background-color: #FDF5E6;} footer{displa
142
  <p style="font-size: .8rem;
143
  display: inline-block;
144
  padding: 0 10px;
145
- transform: translateY(10px)" > Demo for <a href="https://huggingface.co/dreamlike-art/dreamlike-anime-1.0">Dreamlike Diffusion 1.0</a> Stable Diffusion model
 
146
  </p>
147
  </div>
148
  <div class="acknowledgments" style="margin: 1.25em 0 .25em 0;
 
8
  from threading import Thread
9
 
10
  text_gen = gr.Interface.load("models/Gustavosta/MagicPrompt-Stable-Diffusion")
11
+ proc1 = gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
12
 
13
  def restart_script_periodically():
14
  while True:
 
55
  queue.put(prompt_with_noise)
56
  output = proc(prompt_with_noise)
57
  return output
58
+ import random
59
+
60
+ import random
61
+ import time
62
+
63
+ # ... (existing code)
64
+
65
+ import random
66
+ import time
67
+
68
+ # ... (existing code)
69
 
70
  def get_prompts(prompt_text):
71
  global request_counter
72
  request_counter += 1
73
  timestamp = f"{time.time()}_{request_counter}"
74
+
75
+ options = [
76
+ "Cyberpunk android",
77
+ "2060",
78
+ "newyork",
79
+ ", style of laurie greasley" , "studio ghibli" , "akira toriyama" , "james gilleard" , "genshin impact" , "trending pixiv fanbox" , "acrylic palette knife, 4k, vibrant colors, devinart, trending on artstation, low details"
80
+ ", Editorial Photography, Shot on 70mm lens, Depth of Field, Bokeh, DOF, Tilt Blur, Shutter Speed 1/1000, F/22, 32k, Super-Resolution, award winning,",
81
+ ", high detail, warm lighting, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski ",
82
+ ", highly detailed, digital painting, artstation, illustration, art by artgerm and greg rutkowski and alphonse mucha.",
83
+ ", Charlie Bowater, stanley artgerm lau, a character portrait, sots art, sharp focus, smooth, aesthetic, extremely detailed, octane render,solo, dark industrial background, rtx, rock clothes, cinematic light, intricate detail, highly detailed, high res, detailed facial features",
84
+ ", portrait photograph" , "realistic" , "concept art" , "elegant, highly detailed" , "intricate, sharp focus, depth of field, f/1. 8, 85mm, medium shot, mid shot, (((professionally color graded)))" ," sharp focus, bright soft diffused light" , "(volumetric fog),",
85
+ ",Cinematic film still" ," (dark city street:1.2)" , "(cold colors), damp, moist, intricate details" ,"shallow depth of field, [volumetric fog]" , "cinematic lighting, reflections, photographed on a Canon EOS R5, 50mm lens, F/2.8, HDR, 8k resolution" , "cinematic film still from cyberpunk movie" , "volumetric fog, (RAW, analog, masterpiece, best quality, soft particles, 8k, flawless perfect face, intricate details" , "trending on artstation, trending on cgsociety, dlsr, ultra sharp, hdr, rtx, antialiasing, canon 5d foto))" , "((skin details, high detailed skin texture))" , "(((perfect face))), (perfect eyes)))",
86
+
87
+ # Add other prompt options here...
88
+ ]
89
+
90
  if prompt_text:
91
+ chosen_option = random.choice(options)
92
+ return text_gen(f"{prompt_text}, {chosen_option} - {timestamp}")
93
  else:
94
  return text_gen("", timestamp)
95
 
96
+
97
+
98
  # Existing code...
99
 
100
  # Existing code...
101
 
102
+ with gr.Blocks(css=".gradio-container {background-color: #fdf7e6;} footer{display:none !important;}",) as demo:
103
  gr.HTML("""
104
  <div style="text-align: center; max-width: 700px; margin: 0 auto;">
105
  <div
 
112
  >
113
  <div>
114
  <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
115
+ Dreamlike Photoreal 2.0
116
  </h1>
117
  </div>
118
  </div>
 
164
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
165
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
166
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output2])
167
+ gr.HTML("""
168
+ <div class="footer" style="margin-bottom: 45px;
169
  margin-top: 35px;
170
  text-align: center;
171
  border-bottom: 1px solid #e5e5e5"
 
173
  <p style="font-size: .8rem;
174
  display: inline-block;
175
  padding: 0 10px;
176
+ transform: translateY(10px);
177
+ background: white" > Demo for <a href="https://huggingface.co/dreamlike-art/dreamlike-photoreal-2.0">Dreamlike Photoreal 2.0</a> Stable Diffusion model
178
  </p>
179
  </div>
180
  <div class="acknowledgments" style="margin: 1.25em 0 .25em 0;