salomonsky commited on
Commit
a8ca835
1 Parent(s): 9cf36f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
  import gradio as gr
3
  import numpy as np
@@ -11,6 +12,7 @@ from PIL import Image
11
 
12
  translator = Translator()
13
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
 
14
  basemodel = "black-forest-labs/FLUX.1-dev"
15
  MAX_SEED = np.iinfo(np.int32).max
16
 
@@ -81,6 +83,19 @@ async def gen(
81
  image, seed = await generate_image(prompt,model,lora_word,width,height,scales,steps,seed)
82
  return image, seed
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
85
  gr.HTML("<h1><center>Flux Lab Light</center></h1>")
86
  gr.HTML("<p><center>Powered By HF Inference API</center></p>")
@@ -141,6 +156,15 @@ with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
141
  value="",
142
  )
143
 
 
 
 
 
 
 
 
 
 
144
  gr.on(
145
  triggers=[
146
  prompt.submit,
@@ -161,4 +185,4 @@ with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
161
  )
162
 
163
  if __name__ == "__main__":
164
- demo.queue(api_open=False).launch(show_api=False, share=False)
 
1
+ #Save ZeroGPU limited resources, switch to InferenceAPI
2
  import os
3
  import gradio as gr
4
  import numpy as np
 
12
 
13
  translator = Translator()
14
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
15
+ # Constants
16
  basemodel = "black-forest-labs/FLUX.1-dev"
17
  MAX_SEED = np.iinfo(np.int32).max
18
 
 
83
  image, seed = await generate_image(prompt,model,lora_word,width,height,scales,steps,seed)
84
  return image, seed
85
 
86
+ examples = [
87
+ ["a seal holding a beach ball in a pool","bingbangboom/flux_dreamscape","in the style of BSstyle004"],
88
+ ["1980s anime screengrab, VHS quality, a woman with her face glitching and disorted, a halo above her head","dataautogpt3/FLUX-SyntheticAnime","1980s anime screengrab, VHS quality"],
89
+ ["photograph, background of Earth from space, red car on the Moon watching Earth","martintomov/retrofuturism-flux","retrofuturism"],
90
+ ["a living room interior","fofr/flux-80s-cyberpunk","80s cyberpunk"],
91
+ ["Shrek, a lovable green ogre with a big smile, sitting on a moss-covered rock while enjoying a plate of freshly picked vegetables, in a magical forest filled with whimsical creatures, dappled sunlight filtering through the trees, surrounded by curious fairies peeking out from behind leaves","alvarobartt/ghibli-characters-flux-lora","Ghibli style"],
92
+ ["a tourist in London, illustration in the style of VCTRNDRWNG, Victorian-era drawing","dvyio/flux-lora-victorian-drawing","illustration in the style of VCTRNDRWNG"],
93
+ ["an African American and a caucasian man petting a cat at a busy electronic store. flikr photo from 2012. three people working in the background","kudzueye/boreal-flux-dev-v2","photo"],
94
+ ["mgwr/cine, woman silhouette, morning light, sun rays, indoor scene, soft focus, golden hour, stretching pose, peaceful mood, cozy atmosphere, window light, shadows and highlights, backlit figure, minimalistic interior, warm tones, contemplative moment, calm energy, serene environment, yoga-inspired, elegant posture, natural light beams, artistic composition","mgwr/Cine-Aesthetic","atmospheric lighting and a dreamy, surreal vibe"]
95
+ ]
96
+
97
+ # Gradio Interface
98
+
99
  with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
100
  gr.HTML("<h1><center>Flux Lab Light</center></h1>")
101
  gr.HTML("<p><center>Powered By HF Inference API</center></p>")
 
156
  value="",
157
  )
158
 
159
+ gr.Examples(
160
+ examples=examples,
161
+ inputs=[prompt,lora_add,lora_word],
162
+ outputs=[img, seed],
163
+ fn=gen,
164
+ cache_examples="lazy",
165
+ examples_per_page=4,
166
+ )
167
+
168
  gr.on(
169
  triggers=[
170
  prompt.submit,
 
185
  )
186
 
187
  if __name__ == "__main__":
188
+ demo.queue(api_open=False).launch(show_api=False, share=False)