ZennyKenny commited on
Commit
c3ce72d
·
verified ·
1 Parent(s): 4d4a6c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
2
  import numpy as np
3
  import random
4
 
5
- # import spaces #[uncomment to use ZeroGPU]
6
  from diffusers import DiffusionPipeline
7
  import torch
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
- model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
11
 
12
  if torch.cuda.is_available():
13
  torch_dtype = torch.float16
@@ -21,7 +21,7 @@ MAX_SEED = np.iinfo(np.int32).max
21
  MAX_IMAGE_SIZE = 1024
22
 
23
 
24
- # @spaces.GPU #[uncomment to use ZeroGPU]
25
  def infer(
26
  prompt,
27
  negative_prompt,
@@ -38,6 +38,9 @@ def infer(
38
 
39
  generator = torch.Generator().manual_seed(seed)
40
 
 
 
 
41
  image = pipe(
42
  prompt=prompt,
43
  negative_prompt=negative_prompt,
@@ -51,10 +54,11 @@ def infer(
51
  return image, seed
52
 
53
 
 
54
  examples = [
55
- "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
56
- "An astronaut riding a green horse",
57
- "A delicious ceviche cheesecake slice",
58
  ]
59
 
60
  css = """
@@ -64,7 +68,7 @@ css = """
64
  }
65
  """
66
 
67
- with gr.Blocks(css=css) as demo:
68
  with gr.Column(elem_id="col-container"):
69
  gr.Markdown(" # Text-to-Image Gradio Template")
70
 
@@ -151,4 +155,4 @@ with gr.Blocks(css=css) as demo:
151
  )
152
 
153
  if __name__ == "__main__":
154
- demo.launch()
 
2
  import numpy as np
3
  import random
4
 
5
+ import spaces
6
  from diffusers import DiffusionPipeline
7
  import torch
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
+ model_repo_id = "ZennyKenny/flux_lora_natalie-diffusion"
11
 
12
  if torch.cuda.is_available():
13
  torch_dtype = torch.float16
 
21
  MAX_IMAGE_SIZE = 1024
22
 
23
 
24
+ @spaces.GPU
25
  def infer(
26
  prompt,
27
  negative_prompt,
 
38
 
39
  generator = torch.Generator().manual_seed(seed)
40
 
41
+ # Append "XTON" to the prompt
42
+ prompt = "XTON " + prompt
43
+
44
  image = pipe(
45
  prompt=prompt,
46
  negative_prompt=negative_prompt,
 
54
  return image, seed
55
 
56
 
57
+
58
  examples = [
59
+ "A man walking in a forest",
60
+ "A viking ship sailing on a river at night",
61
+ "A woman dancing in a tavern",
62
  ]
63
 
64
  css = """
 
68
  }
69
  """
70
 
71
+ with gr.Blocks(css=css) as natalie_diffusion:
72
  with gr.Column(elem_id="col-container"):
73
  gr.Markdown(" # Text-to-Image Gradio Template")
74
 
 
155
  )
156
 
157
  if __name__ == "__main__":
158
+ natalie_diffusion.launch()