DGSpitzer commited on
Commit
88988e2
1 Parent(s): d7729cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -21,7 +21,7 @@ prompt_prefixes = {
21
 
22
  current_model = models[0]
23
 
24
- #auth_token = os.environ.get("adminToken") or True
25
  #pipe = StableDiffusionPipeline.from_pretrained(current_model, use_auth_token=auth_token, torch_dtype=torchfloat, revision="fp16")
26
  pipe = StableDiffusionPipeline.from_pretrained(current_model, torch_dtype=torchfloat, revision="fp16")
27
 
@@ -44,9 +44,10 @@ def on_model_change(model):
44
 
45
  def inference(prompt, guidance, steps):
46
 
 
47
  prompt = prompt_prefixes[current_model] + prompt
48
  image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
49
- return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
50
 
51
  def inference_example(prompt, guidance, steps):
52
 
@@ -131,11 +132,10 @@ with gr.Blocks(css=css) as demo:
131
  share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
132
 
133
  model.change(on_model_change, inputs=model, outputs=[])
134
- run.click(inference, inputs=[prompt, guidance, steps], outputs=[image_out, share_button, community_icon, loading_icon])
135
 
136
  share_button.click(None, [], [], _js=share_js)
137
 
138
-
139
  gr.Examples([
140
  ["portrait of anime girl", 7.5, 27],
141
  ["a beautiful perfect face girl, Anime fine details portrait of school girl in front of modern tokyo city landscape on the background deep bokeh, anime masterpiece by studio ghibli, 8k, sharp high quality anime, artstation", 7.5, 27],
 
21
 
22
  current_model = models[0]
23
 
24
+ #auth_token = os.environ.get("test") or True
25
  #pipe = StableDiffusionPipeline.from_pretrained(current_model, use_auth_token=auth_token, torch_dtype=torchfloat, revision="fp16")
26
  pipe = StableDiffusionPipeline.from_pretrained(current_model, torch_dtype=torchfloat, revision="fp16")
27
 
 
44
 
45
  def inference(prompt, guidance, steps):
46
 
47
+ promptPrev = prompt
48
  prompt = prompt_prefixes[current_model] + prompt
49
  image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
50
+ return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(placeholder=promptPrev)
51
 
52
  def inference_example(prompt, guidance, steps):
53
 
 
132
  share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
133
 
134
  model.change(on_model_change, inputs=model, outputs=[])
135
+ run.click(inference, inputs=[prompt, guidance, steps], outputs=[image_out, share_button, community_icon, loading_icon, prompt])
136
 
137
  share_button.click(None, [], [], _js=share_js)
138
 
 
139
  gr.Examples([
140
  ["portrait of anime girl", 7.5, 27],
141
  ["a beautiful perfect face girl, Anime fine details portrait of school girl in front of modern tokyo city landscape on the background deep bokeh, anime masterpiece by studio ghibli, 8k, sharp high quality anime, artstation", 7.5, 27],