Nymbo commited on
Commit
289206f
1 Parent(s): 18acd83

Adding support for custom inference models/LoRAs

Browse files
Files changed (1) hide show
  1. app.py +219 -216
app.py CHANGED
@@ -10,19 +10,20 @@ import json
10
  # Project by Nymbo
11
 
12
  # Base API URL for Hugging Face inference
13
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
14
  # Retrieve the API token from environment variables
15
  API_TOKEN = os.getenv("HF_READ_TOKEN")
16
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
17
  # Timeout for requests
18
  timeout = 100
19
 
20
- def query(prompt, model, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
21
  # Debug log to indicate function start
22
  print("Starting query function...")
23
  # Print the parameters for debugging purposes
24
  print(f"Prompt: {prompt}")
25
  print(f"Model: {model}")
 
26
  print(f"Parameters - Steps: {steps}, CFG Scale: {cfg_scale}, Seed: {seed}, Strength: {strength}, Width: {width}, Height: {height}")
27
 
28
  # Check if the prompt is empty or None
@@ -43,211 +44,209 @@ def query(prompt, model, is_negative=False, steps=35, cfg_scale=7, sampler="DPM+
43
  prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
44
  print(f'Generation {key}: {prompt}') # Debug log
45
 
46
- # Set the API URL based on the selected model
47
-
48
- # if model == 'X':
49
- # API_URL = "https://api-inference.huggingface.co/models/X"
50
- # prompt = f"X, {prompt}"
51
-
52
- if model == 'Stable Diffusion XL':
53
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
54
- if model == 'FLUX.1 [Dev]':
55
- API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
56
- if model == 'FLUX.1 [Schnell]':
57
- API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell"
58
- if model == 'Flux Logo Design':
59
- API_URL = "https://api-inference.huggingface.co/models/Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design"
60
- prompt = f"wablogo, logo, Minimalist, {prompt}"
61
- if model == 'Flux Uncensored':
62
- API_URL = "https://api-inference.huggingface.co/models/enhanceaiteam/Flux-uncensored"
63
- if model == 'Flux Uncensored V2':
64
- API_URL = "https://api-inference.huggingface.co/models/enhanceaiteam/Flux-Uncensored-V2"
65
- if model == 'Flux Tarot Cards':
66
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Ton618-Tarot-Cards-Flux-LoRA"
67
- prompt = f"Tarot card, {prompt}"
68
- if model == 'Pixel Art Sprites':
69
- API_URL = "https://api-inference.huggingface.co/models/sWizad/pokemon-trainer-sprites-pixelart-flux"
70
- prompt = f"a pixel image, {prompt}"
71
- if model == '3D Sketchfab':
72
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Castor-3D-Sketchfab-Flux-LoRA"
73
- prompt = f"3D Sketchfab, {prompt}"
74
- if model == 'Retro Comic Flux':
75
- API_URL = "https://api-inference.huggingface.co/models/renderartist/retrocomicflux"
76
- prompt = f"c0m1c, comic book panel, {prompt}"
77
- if model == 'Caricature':
78
- API_URL = "https://api-inference.huggingface.co/models/TheAwakenOne/caricature"
79
- prompt = f"CCTUR3, {prompt}"
80
- if model == 'Huggieverse':
81
- API_URL = "https://api-inference.huggingface.co/models/Chunte/flux-lora-Huggieverse"
82
- prompt = f"HGGRE, {prompt}"
83
- if model == 'Propaganda Poster':
84
- API_URL = "https://api-inference.huggingface.co/models/AlekseyCalvin/Propaganda_Poster_Schnell_by_doctor_diffusion"
85
- prompt = f"propaganda poster, {prompt}"
86
- if model == 'Flux Game Assets V2':
87
- API_URL = "https://api-inference.huggingface.co/models/gokaygokay/Flux-Game-Assets-LoRA-v2"
88
- prompt = f"wbgmsst, white background, {prompt}"
89
- if model == 'SoftPasty Flux':
90
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/softpasty-flux-dev"
91
- prompt = f"araminta_illus illustration style, {prompt}"
92
- if model == 'Flux Stickers':
93
- API_URL = "https://api-inference.huggingface.co/models/diabolic6045/Flux_Sticker_Lora"
94
- prompt = f"5t1cker 5ty1e, {prompt}"
95
- if model == 'Flux Animex V2':
96
- API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Animex-v2-LoRA"
97
- prompt = f"Animex, {prompt}"
98
- if model == 'Flux Animeo V1':
99
- API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Animeo-v1-LoRA"
100
- prompt = f"Animeo, {prompt}"
101
- if model == 'Movie Board':
102
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Flux.1-Dev-Movie-Boards-LoRA"
103
- prompt = f"movieboard, {prompt}"
104
- if model == 'Purple Dreamy':
105
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Purple-Dreamy-Flux-LoRA"
106
- prompt = f"Purple Dreamy, {prompt}"
107
- if model == 'PS1 Style Flux':
108
- API_URL = "https://api-inference.huggingface.co/models/veryVANYA/ps1-style-flux"
109
- prompt = f"ps1 game screenshot, {prompt}"
110
- if model == 'Softserve Anime':
111
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/softserve_anime"
112
- prompt = f"sftsrv style illustration, {prompt}"
113
- if model == 'Flux Tarot v1':
114
- API_URL = "https://api-inference.huggingface.co/models/multimodalart/flux-tarot-v1"
115
- prompt = f"in the style of TOK a trtcrd tarot style, {prompt}"
116
- if model == 'Half Illustration':
117
- API_URL = "https://api-inference.huggingface.co/models/davisbro/half_illustration"
118
- prompt = f"in the style of TOK, {prompt}"
119
- if model == 'OpenDalle v1.1':
120
- API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/OpenDalleV1.1"
121
- if model == 'Flux Ghibsky Illustration':
122
- API_URL = "https://api-inference.huggingface.co/models/aleksa-codes/flux-ghibsky-illustration"
123
- prompt = f"GHIBSKY style, {prompt}"
124
- if model == 'Flux Koda':
125
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/flux-koda"
126
- prompt = f"flmft style, {prompt}"
127
- if model == 'Soviet Diffusion XL':
128
- API_URL = "https://api-inference.huggingface.co/models/openskyml/soviet-diffusion-xl"
129
- prompt = f"soviet poster, {prompt}"
130
- if model == 'Flux Realism LoRA':
131
- API_URL = "https://api-inference.huggingface.co/models/XLabs-AI/flux-RealismLora"
132
- if model == 'Frosting Lane Flux':
133
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/frosting_lane_flux"
134
- prompt = f"frstingln illustration, {prompt}"
135
- if model == 'Phantasma Anime':
136
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/phantasma-anime"
137
- if model == 'Boreal':
138
- API_URL = "https://api-inference.huggingface.co/models/kudzueye/Boreal"
139
- prompt = f"photo, {prompt}"
140
- if model == 'How2Draw':
141
- API_URL = "https://api-inference.huggingface.co/models/glif/how2draw"
142
- prompt = f"How2Draw, {prompt}"
143
- if model == 'Flux AestheticAnime':
144
- API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/FLUX-AestheticAnime"
145
- if model == 'Fashion Hut Modeling LoRA':
146
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Fashion-Hut-Modeling-LoRA"
147
- prompt = f"Modeling of, {prompt}"
148
- if model == 'Flux SyntheticAnime':
149
- API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/FLUX-SyntheticAnime"
150
- prompt = f"1980s anime screengrab, VHS quality, syntheticanime, {prompt}"
151
- if model == 'Flux Midjourney Anime':
152
- API_URL = "https://api-inference.huggingface.co/models/brushpenbob/flux-midjourney-anime"
153
- prompt = f"egmid, {prompt}"
154
- if model == 'Coloring Book Generator':
155
- API_URL = "https://api-inference.huggingface.co/models/robert123231/coloringbookgenerator"
156
- if model == 'Collage Flux':
157
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Castor-Collage-Dim-Flux-LoRA"
158
- prompt = f"collage, {prompt}"
159
- if model == 'Flux Product Ad Backdrop':
160
- API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Flux-Product-Ad-Backdrop"
161
- prompt = f"Product Ad, {prompt}"
162
- if model == 'Product Design':
163
- API_URL = "https://api-inference.huggingface.co/models/multimodalart/product-design"
164
- prompt = f"product designed by prdsgn, {prompt}"
165
- if model == '90s Anime Art':
166
- API_URL = "https://api-inference.huggingface.co/models/glif/90s-anime-art"
167
- if model == 'Brain Melt Acid Art':
168
- API_URL = "https://api-inference.huggingface.co/models/glif/Brain-Melt-Acid-Art"
169
- prompt = f"maximalism, in an acid surrealism style, {prompt}"
170
- if model == 'Lustly Flux Uncensored v1':
171
- API_URL = "https://api-inference.huggingface.co/models/lustlyai/Flux_Lustly.ai_Uncensored_nsfw_v1"
172
- if model == 'NSFW Master Flux':
173
- API_URL = "https://api-inference.huggingface.co/models/Keltezaa/NSFW_MASTER_FLUX"
174
- prompt = f"NSFW, {prompt}"
175
- if model == 'Flux Outfit Generator':
176
- API_URL = "https://api-inference.huggingface.co/models/tryonlabs/FLUX.1-dev-LoRA-Outfit-Generator"
177
- if model == 'Midjourney':
178
- API_URL = "https://api-inference.huggingface.co/models/Jovie/Midjourney"
179
- if model == 'DreamPhotoGASM':
180
- API_URL = "https://api-inference.huggingface.co/models/Yntec/DreamPhotoGASM"
181
- if model == 'Flux Super Realism LoRA':
182
- API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Super-Realism-LoRA"
183
- if model == 'Stable Diffusion 2-1':
184
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1-base"
185
- if model == 'Stable Diffusion 3.5 Large':
186
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3.5-large"
187
- if model == 'Stable Diffusion 3.5 Large Turbo':
188
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3.5-large-turbo"
189
- if model == 'Stable Diffusion 3 Medium':
190
- API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3-medium-diffusers"
191
- prompt = f"A, {prompt}"
192
- if model == 'Duchaiten Real3D NSFW XL':
193
- API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/duchaiten-real3d-nsfw-xl"
194
- if model == 'Pixel Art XL':
195
- API_URL = "https://api-inference.huggingface.co/models/nerijs/pixel-art-xl"
196
- prompt = f"pixel art, {prompt}"
197
- if model == 'Character Design':
198
- API_URL = "https://api-inference.huggingface.co/models/KappaNeuro/character-design"
199
- prompt = f"Character Design, {prompt}"
200
- if model == 'Sketched Out Manga':
201
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/sketchedoutmanga"
202
- prompt = f"daiton, {prompt}"
203
- if model == 'Archfey Anime':
204
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/archfey_anime"
205
- if model == 'Lofi Cuties':
206
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/lofi-cuties"
207
- if model == 'YiffyMix':
208
- API_URL = "https://api-inference.huggingface.co/models/Yntec/YiffyMix"
209
- if model == 'Analog Madness Realistic v7':
210
- API_URL = "https://api-inference.huggingface.co/models/digiplay/AnalogMadness-realistic-model-v7"
211
- if model == 'Selfie Photography':
212
- API_URL = "https://api-inference.huggingface.co/models/artificialguybr/selfiephotographyredmond-selfie-photography-lora-for-sdxl"
213
- prompt = f"instagram model, discord profile picture, {prompt}"
214
- if model == 'Filmgrain':
215
- API_URL = "https://api-inference.huggingface.co/models/artificialguybr/filmgrain-redmond-filmgrain-lora-for-sdxl"
216
- prompt = f"Film Grain, FilmGrainAF, {prompt}"
217
- if model == 'Leonardo AI Style Illustration':
218
- API_URL = "https://api-inference.huggingface.co/models/goofyai/Leonardo_Ai_Style_Illustration"
219
- prompt = f"leonardo style, illustration, vector art, {prompt}"
220
- if model == 'Cyborg Style XL':
221
- API_URL = "https://api-inference.huggingface.co/models/goofyai/cyborg_style_xl"
222
- prompt = f"cyborg style, {prompt}"
223
- if model == 'Little Tinies':
224
- API_URL = "https://api-inference.huggingface.co/models/alvdansen/littletinies"
225
- if model == 'NSFW XL':
226
- API_URL = "https://api-inference.huggingface.co/models/Dremmar/nsfw-xl"
227
- if model == 'Analog Redmond':
228
- API_URL = "https://api-inference.huggingface.co/models/artificialguybr/analogredmond"
229
- prompt = f"timeless style, {prompt}"
230
- if model == 'Pixel Art Redmond':
231
- API_URL = "https://api-inference.huggingface.co/models/artificialguybr/PixelArtRedmond"
232
- prompt = f"Pixel Art, {prompt}"
233
- if model == 'Ascii Art':
234
- API_URL = "https://api-inference.huggingface.co/models/CiroN2022/ascii-art"
235
- prompt = f"ascii art, {prompt}"
236
- if model == 'Analog':
237
- API_URL = "https://api-inference.huggingface.co/models/Yntec/Analog"
238
- if model == 'Maple Syrup':
239
- API_URL = "https://api-inference.huggingface.co/models/Yntec/MapleSyrup"
240
- if model == 'Perfect Lewd Fantasy':
241
- API_URL = "https://api-inference.huggingface.co/models/digiplay/perfectLewdFantasy_v1.01"
242
- if model == 'AbsoluteReality 1.8.1':
243
- API_URL = "https://api-inference.huggingface.co/models/digiplay/AbsoluteReality_v1.8.1"
244
- if model == 'Disney':
245
- API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
246
- prompt = f"Disney style, {prompt}"
247
- if model == 'Redmond SDXL':
248
- API_URL = "https://api-inference.huggingface.co/models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2"
249
- if model == 'epiCPhotoGasm':
250
- API_URL = "https://api-inference.huggingface.co/models/Yntec/epiCPhotoGasm"
251
  print(f"API URL set to: {API_URL}") # Debug log
252
 
253
  # Define the payload for the request
@@ -290,7 +289,7 @@ def query(prompt, model, is_negative=False, steps=35, cfg_scale=7, sampler="DPM+
290
  raise gr.Error(f"{response.status_code}: The model is being loaded. Please try again later.")
291
  else:
292
  raise gr.Error(f"{response.status_code}: An unexpected error occurred.")
293
-
294
  try:
295
  # Attempt to read the image from the response content
296
  image_bytes = response.content
@@ -319,11 +318,14 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme_5') as dalle:
319
  with gr.Row():
320
  # Textbox for user to input the prompt
321
  text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=3, elem_id="prompt-text-input")
 
 
 
322
  with gr.Row():
323
  # Accordion for selecting the model
324
- with gr.Accordion("Model Selection", open=True):
325
  # Textbox for searching models
326
- model_search = gr.Textbox(label="Search Models", placeholder="Search for a model...", lines=1, elem_id="model-search-input")
327
  models_list = (
328
  "3D Sketchfab",
329
  "90s Anime Art",
@@ -467,11 +469,12 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme_5') as dalle:
467
  with gr.Row():
468
  # Display a sample prompt for guidance
469
  gr.Textbox(label="Sample prompt", value="{prompt} | ultra detail, ultra elaboration, ultra quality, perfect.")
470
-
471
  # Accordion displaying featured models
472
  with gr.Accordion("Featured Models (WiP)", open=False):
473
  gr.HTML(
474
  """
 
475
  <table style="width:100%; text-align:center; margin:auto;">
476
  <tr>
477
  <th>Model Name</th>
@@ -494,14 +497,13 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme_5') as dalle:
494
  <td></td>
495
  </tr>
496
  </table>
497
-
498
  """
499
  )
500
 
501
  # Accordion providing an overview of advanced settings
502
  with gr.Accordion("Advanced Settings Overview", open=False):
503
  gr.Markdown(
504
- """
505
  ## Negative Prompt
506
  ###### This box is for telling the AI what you don't want in your images. Think of it as a way to avoid certain elements. For instance, if you don't want blurry images or extra limbs showing up, this is where you'd mention it.
507
 
@@ -513,7 +515,7 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme_5') as dalle:
513
 
514
  ## CFG Scale
515
  ###### CFG stands for "Control Free Guidance." The scale adjusts how closely the AI follows your prompt. A lower number makes the AI more creative and free-flowing, while a higher number makes it stick closely to what you asked for. If you want the AI to take fewer artistic liberties, slide this towards a higher number. Just think "Control Freak Gauge".
516
-
517
  ## Sampling Method
518
  ###### This is the technique the AI uses to create your image. Each option is a different approach, like choosing between pencils, markers, or paint. You don't need to worry too much about this; the default setting is usually the best choice for most users.
519
 
@@ -526,15 +528,16 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme_5') as dalle:
526
  ### Remember, these settings are all about giving you control over the image generation process. Feel free to experiment and see what each one does. And if you're ever in doubt, the default settings are a great place to start. Happy creating!
527
  """
528
  )
 
529
  # Row containing the 'Run' button to trigger the image generation
530
  with gr.Row():
531
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
532
  # Row for displaying the generated image output
533
  with gr.Row():
534
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
535
-
536
  # Set up button click event to call the query function
537
- text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
538
 
539
  print("Launching Gradio interface...") # Debug log
540
  # Launch the Gradio interface without showing the API or sharing externally
 
10
  # Project by Nymbo
11
 
12
  # Base API URL for Hugging Face inference
13
+ API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
14
  # Retrieve the API token from environment variables
15
  API_TOKEN = os.getenv("HF_READ_TOKEN")
16
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
17
  # Timeout for requests
18
  timeout = 100
19
 
20
+ def query(prompt, model, custom_lora, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
21
  # Debug log to indicate function start
22
  print("Starting query function...")
23
  # Print the parameters for debugging purposes
24
  print(f"Prompt: {prompt}")
25
  print(f"Model: {model}")
26
+ print(f"Custom LoRA: {custom_lora}")
27
  print(f"Parameters - Steps: {steps}, CFG Scale: {cfg_scale}, Seed: {seed}, Strength: {strength}, Width: {width}, Height: {height}")
28
 
29
  # Check if the prompt is empty or None
 
44
  prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
45
  print(f'Generation {key}: {prompt}') # Debug log
46
 
47
+ # Set the API URL based on the selected model or custom LoRA
48
+ if custom_lora.strip() != "":
49
+ API_URL = f"https://api-inference.huggingface.co/models/{custom_lora.strip()}"
50
+ else:
51
+ if model == 'Stable Diffusion XL':
52
+ API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
53
+ if model == 'FLUX.1 [Dev]':
54
+ API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
55
+ if model == 'FLUX.1 [Schnell]':
56
+ API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell"
57
+ if model == 'Flux Logo Design':
58
+ API_URL = "https://api-inference.huggingface.co/models/Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design"
59
+ prompt = f"wablogo, logo, Minimalist, {prompt}"
60
+ if model == 'Flux Uncensored':
61
+ API_URL = "https://api-inference.huggingface.co/models/enhanceaiteam/Flux-uncensored"
62
+ if model == 'Flux Uncensored V2':
63
+ API_URL = "https://api-inference.huggingface.co/models/enhanceaiteam/Flux-Uncensored-V2"
64
+ if model == 'Flux Tarot Cards':
65
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Ton618-Tarot-Cards-Flux-LoRA"
66
+ prompt = f"Tarot card, {prompt}"
67
+ if model == 'Pixel Art Sprites':
68
+ API_URL = "https://api-inference.huggingface.co/models/sWizad/pokemon-trainer-sprites-pixelart-flux"
69
+ prompt = f"a pixel image, {prompt}"
70
+ if model == '3D Sketchfab':
71
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Castor-3D-Sketchfab-Flux-LoRA"
72
+ prompt = f"3D Sketchfab, {prompt}"
73
+ if model == 'Retro Comic Flux':
74
+ API_URL = "https://api-inference.huggingface.co/models/renderartist/retrocomicflux"
75
+ prompt = f"c0m1c, comic book panel, {prompt}"
76
+ if model == 'Caricature':
77
+ API_URL = "https://api-inference.huggingface.co/models/TheAwakenOne/caricature"
78
+ prompt = f"CCTUR3, {prompt}"
79
+ if model == 'Huggieverse':
80
+ API_URL = "https://api-inference.huggingface.co/models/Chunte/flux-lora-Huggieverse"
81
+ prompt = f"HGGRE, {prompt}"
82
+ if model == 'Propaganda Poster':
83
+ API_URL = "https://api-inference.huggingface.co/models/AlekseyCalvin/Propaganda_Poster_Schnell_by_doctor_diffusion"
84
+ prompt = f"propaganda poster, {prompt}"
85
+ if model == 'Flux Game Assets V2':
86
+ API_URL = "https://api-inference.huggingface.co/models/gokaygokay/Flux-Game-Assets-LoRA-v2"
87
+ prompt = f"wbgmsst, white background, {prompt}"
88
+ if model == 'SoftPasty Flux':
89
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/softpasty-flux-dev"
90
+ prompt = f"araminta_illus illustration style, {prompt}"
91
+ if model == 'Flux Stickers':
92
+ API_URL = "https://api-inference.huggingface.co/models/diabolic6045/Flux_Sticker_Lora"
93
+ prompt = f"5t1cker 5ty1e, {prompt}"
94
+ if model == 'Flux Animex V2':
95
+ API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Animex-v2-LoRA"
96
+ prompt = f"Animex, {prompt}"
97
+ if model == 'Flux Animeo V1':
98
+ API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Animeo-v1-LoRA"
99
+ prompt = f"Animeo, {prompt}"
100
+ if model == 'Movie Board':
101
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Flux.1-Dev-Movie-Boards-LoRA"
102
+ prompt = f"movieboard, {prompt}"
103
+ if model == 'Purple Dreamy':
104
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Purple-Dreamy-Flux-LoRA"
105
+ prompt = f"Purple Dreamy, {prompt}"
106
+ if model == 'PS1 Style Flux':
107
+ API_URL = "https://api-inference.huggingface.co/models/veryVANYA/ps1-style-flux"
108
+ prompt = f"ps1 game screenshot, {prompt}"
109
+ if model == 'Softserve Anime':
110
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/softserve_anime"
111
+ prompt = f"sftsrv style illustration, {prompt}"
112
+ if model == 'Flux Tarot v1':
113
+ API_URL = "https://api-inference.huggingface.co/models/multimodalart/flux-tarot-v1"
114
+ prompt = f"in the style of TOK a trtcrd tarot style, {prompt}"
115
+ if model == 'Half Illustration':
116
+ API_URL = "https://api-inference.huggingface.co/models/davisbro/half_illustration"
117
+ prompt = f"in the style of TOK, {prompt}"
118
+ if model == 'OpenDalle v1.1':
119
+ API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/OpenDalleV1.1"
120
+ if model == 'Flux Ghibsky Illustration':
121
+ API_URL = "https://api-inference.huggingface.co/models/aleksa-codes/flux-ghibsky-illustration"
122
+ prompt = f"GHIBSKY style, {prompt}"
123
+ if model == 'Flux Koda':
124
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/flux-koda"
125
+ prompt = f"flmft style, {prompt}"
126
+ if model == 'Soviet Diffusion XL':
127
+ API_URL = "https://api-inference.huggingface.co/models/openskyml/soviet-diffusion-xl"
128
+ prompt = f"soviet poster, {prompt}"
129
+ if model == 'Flux Realism LoRA':
130
+ API_URL = "https://api-inference.huggingface.co/models/XLabs-AI/flux-RealismLora"
131
+ if model == 'Frosting Lane Flux':
132
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/frosting_lane_flux"
133
+ prompt = f"frstingln illustration, {prompt}"
134
+ if model == 'Phantasma Anime':
135
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/phantasma-anime"
136
+ if model == 'Boreal':
137
+ API_URL = "https://api-inference.huggingface.co/models/kudzueye/Boreal"
138
+ prompt = f"photo, {prompt}"
139
+ if model == 'How2Draw':
140
+ API_URL = "https://api-inference.huggingface.co/models/glif/how2draw"
141
+ prompt = f"How2Draw, {prompt}"
142
+ if model == 'Flux AestheticAnime':
143
+ API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/FLUX-AestheticAnime"
144
+ if model == 'Fashion Hut Modeling LoRA':
145
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Fashion-Hut-Modeling-LoRA"
146
+ prompt = f"Modeling of, {prompt}"
147
+ if model == 'Flux SyntheticAnime':
148
+ API_URL = "https://api-inference.huggingface.co/models/dataautogpt3/FLUX-SyntheticAnime"
149
+ prompt = f"1980s anime screengrab, VHS quality, syntheticanime, {prompt}"
150
+ if model == 'Flux Midjourney Anime':
151
+ API_URL = "https://api-inference.huggingface.co/models/brushpenbob/flux-midjourney-anime"
152
+ prompt = f"egmid, {prompt}"
153
+ if model == 'Coloring Book Generator':
154
+ API_URL = "https://api-inference.huggingface.co/models/robert123231/coloringbookgenerator"
155
+ if model == 'Collage Flux':
156
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Castor-Collage-Dim-Flux-LoRA"
157
+ prompt = f"collage, {prompt}"
158
+ if model == 'Flux Product Ad Backdrop':
159
+ API_URL = "https://api-inference.huggingface.co/models/prithivMLmods/Flux-Product-Ad-Backdrop"
160
+ prompt = f"Product Ad, {prompt}"
161
+ if model == 'Product Design':
162
+ API_URL = "https://api-inference.huggingface.co/models/multimodalart/product-design"
163
+ prompt = f"product designed by prdsgn, {prompt}"
164
+ if model == '90s Anime Art':
165
+ API_URL = "https://api-inference.huggingface.co/models/glif/90s-anime-art"
166
+ if model == 'Brain Melt Acid Art':
167
+ API_URL = "https://api-inference.huggingface.co/models/glif/Brain-Melt-Acid-Art"
168
+ prompt = f"maximalism, in an acid surrealism style, {prompt}"
169
+ if model == 'Lustly Flux Uncensored v1':
170
+ API_URL = "https://api-inference.huggingface.co/models/lustlyai/Flux_Lustly.ai_Uncensored_nsfw_v1"
171
+ if model == 'NSFW Master Flux':
172
+ API_URL = "https://api-inference.huggingface.co/models/Keltezaa/NSFW_MASTER_FLUX"
173
+ prompt = f"NSFW, {prompt}"
174
+ if model == 'Flux Outfit Generator':
175
+ API_URL = "https://api-inference.huggingface.co/models/tryonlabs/FLUX.1-dev-LoRA-Outfit-Generator"
176
+ if model == 'Midjourney':
177
+ API_URL = "https://api-inference.huggingface.co/models/Jovie/Midjourney"
178
+ if model == 'DreamPhotoGASM':
179
+ API_URL = "https://api-inference.huggingface.co/models/Yntec/DreamPhotoGASM"
180
+ if model == 'Flux Super Realism LoRA':
181
+ API_URL = "https://api-inference.huggingface.co/models/strangerzonehf/Flux-Super-Realism-LoRA"
182
+ if model == 'Stable Diffusion 2-1':
183
+ API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1-base"
184
+ if model == 'Stable Diffusion 3.5 Large':
185
+ API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3.5-large"
186
+ if model == 'Stable Diffusion 3.5 Large Turbo':
187
+ API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3.5-large-turbo"
188
+ if model == 'Stable Diffusion 3 Medium':
189
+ API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3-medium-diffusers"
190
+ prompt = f"A, {prompt}"
191
+ if model == 'Duchaiten Real3D NSFW XL':
192
+ API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/duchaiten-real3d-nsfw-xl"
193
+ if model == 'Pixel Art XL':
194
+ API_URL = "https://api-inference.huggingface.co/models/nerijs/pixel-art-xl"
195
+ prompt = f"pixel art, {prompt}"
196
+ if model == 'Character Design':
197
+ API_URL = "https://api-inference.huggingface.co/models/KappaNeuro/character-design"
198
+ prompt = f"Character Design, {prompt}"
199
+ if model == 'Sketched Out Manga':
200
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/sketchedoutmanga"
201
+ prompt = f"daiton, {prompt}"
202
+ if model == 'Archfey Anime':
203
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/archfey_anime"
204
+ if model == 'Lofi Cuties':
205
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/lofi-cuties"
206
+ if model == 'YiffyMix':
207
+ API_URL = "https://api-inference.huggingface.co/models/Yntec/YiffyMix"
208
+ if model == 'Analog Madness Realistic v7':
209
+ API_URL = "https://api-inference.huggingface.co/models/digiplay/AnalogMadness-realistic-model-v7"
210
+ if model == 'Selfie Photography':
211
+ API_URL = "https://api-inference.huggingface.co/models/artificialguybr/selfiephotographyredmond-selfie-photography-lora-for-sdxl"
212
+ prompt = f"instagram model, discord profile picture, {prompt}"
213
+ if model == 'Filmgrain':
214
+ API_URL = "https://api-inference.huggingface.co/models/artificialguybr/filmgrain-redmond-filmgrain-lora-for-sdxl"
215
+ prompt = f"Film Grain, FilmGrainAF, {prompt}"
216
+ if model == 'Leonardo AI Style Illustration':
217
+ API_URL = "https://api-inference.huggingface.co/models/goofyai/Leonardo_Ai_Style_Illustration"
218
+ prompt = f"leonardo style, illustration, vector art, {prompt}"
219
+ if model == 'Cyborg Style XL':
220
+ API_URL = "https://api-inference.huggingface.co/models/goofyai/cyborg_style_xl"
221
+ prompt = f"cyborg style, {prompt}"
222
+ if model == 'Little Tinies':
223
+ API_URL = "https://api-inference.huggingface.co/models/alvdansen/littletinies"
224
+ if model == 'NSFW XL':
225
+ API_URL = "https://api-inference.huggingface.co/models/Dremmar/nsfw-xl"
226
+ if model == 'Analog Redmond':
227
+ API_URL = "https://api-inference.huggingface.co/models/artificialguybr/analogredmond"
228
+ prompt = f"timeless style, {prompt}"
229
+ if model == 'Pixel Art Redmond':
230
+ API_URL = "https://api-inference.huggingface.co/models/artificialguybr/PixelArtRedmond"
231
+ prompt = f"Pixel Art, {prompt}"
232
+ if model == 'Ascii Art':
233
+ API_URL = "https://api-inference.huggingface.co/models/CiroN2022/ascii-art"
234
+ prompt = f"ascii art, {prompt}"
235
+ if model == 'Analog':
236
+ API_URL = "https://api-inference.huggingface.co/models/Yntec/Analog"
237
+ if model == 'Maple Syrup':
238
+ API_URL = "https://api-inference.huggingface.co/models/Yntec/MapleSyrup"
239
+ if model == 'Perfect Lewd Fantasy':
240
+ API_URL = "https://api-inference.huggingface.co/models/digiplay/perfectLewdFantasy_v1.01"
241
+ if model == 'AbsoluteReality 1.8.1':
242
+ API_URL = "https://api-inference.huggingface.co/models/digiplay/AbsoluteReality_v1.8.1"
243
+ if model == 'Disney':
244
+ API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
245
+ prompt = f"Disney style, {prompt}"
246
+ if model == 'Redmond SDXL':
247
+ API_URL = "https://api-inference.huggingface.co/models/artificialguybr/LogoRedmond-LogoLoraForSDXL-V2"
248
+ if model == 'epiCPhotoGasm':
249
+ API_URL = "https://api-inference.huggingface.co/models/Yntec/epiCPhotoGasm"
 
 
250
  print(f"API URL set to: {API_URL}") # Debug log
251
 
252
  # Define the payload for the request
 
289
  raise gr.Error(f"{response.status_code}: The model is being loaded. Please try again later.")
290
  else:
291
  raise gr.Error(f"{response.status_code}: An unexpected error occurred.")
292
+
293
  try:
294
  # Attempt to read the image from the response content
295
  image_bytes = response.content
 
318
  with gr.Row():
319
  # Textbox for user to input the prompt
320
  text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=3, elem_id="prompt-text-input")
321
+ with gr.Row():
322
+ # Textbox for custom LoRA input
323
+ custom_lora = gr.Textbox(label="Custom LoRA", info="LoRA Hugging Face path (optional)", placeholder="multimodalart/vintage-ads-flux")
324
  with gr.Row():
325
  # Accordion for selecting the model
326
+ with gr.Accordion("Featured Models", open=True):
327
  # Textbox for searching models
328
+ model_search = gr.Textbox(label="Filter Models", placeholder="Search for a featured model...", lines=1, elem_id="model-search-input")
329
  models_list = (
330
  "3D Sketchfab",
331
  "90s Anime Art",
 
469
  with gr.Row():
470
  # Display a sample prompt for guidance
471
  gr.Textbox(label="Sample prompt", value="{prompt} | ultra detail, ultra elaboration, ultra quality, perfect.")
472
+
473
  # Accordion displaying featured models
474
  with gr.Accordion("Featured Models (WiP)", open=False):
475
  gr.HTML(
476
  """
477
+ <p><a href="https://huggingface.co/models?inference=warm&sort=likes&search=stable-diffusion">See all available models</a></p>
478
  <table style="width:100%; text-align:center; margin:auto;">
479
  <tr>
480
  <th>Model Name</th>
 
497
  <td></td>
498
  </tr>
499
  </table>
 
500
  """
501
  )
502
 
503
  # Accordion providing an overview of advanced settings
504
  with gr.Accordion("Advanced Settings Overview", open=False):
505
  gr.Markdown(
506
+ """
507
  ## Negative Prompt
508
  ###### This box is for telling the AI what you don't want in your images. Think of it as a way to avoid certain elements. For instance, if you don't want blurry images or extra limbs showing up, this is where you'd mention it.
509
 
 
515
 
516
  ## CFG Scale
517
  ###### CFG stands for "Control Free Guidance." The scale adjusts how closely the AI follows your prompt. A lower number makes the AI more creative and free-flowing, while a higher number makes it stick closely to what you asked for. If you want the AI to take fewer artistic liberties, slide this towards a higher number. Just think "Control Freak Gauge".
518
+
519
  ## Sampling Method
520
  ###### This is the technique the AI uses to create your image. Each option is a different approach, like choosing between pencils, markers, or paint. You don't need to worry too much about this; the default setting is usually the best choice for most users.
521
 
 
528
  ### Remember, these settings are all about giving you control over the image generation process. Feel free to experiment and see what each one does. And if you're ever in doubt, the default settings are a great place to start. Happy creating!
529
  """
530
  )
531
+
532
  # Row containing the 'Run' button to trigger the image generation
533
  with gr.Row():
534
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
535
  # Row for displaying the generated image output
536
  with gr.Row():
537
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
538
+
539
  # Set up button click event to call the query function
540
+ text_button.click(query, inputs=[text_prompt, model, custom_lora, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
541
 
542
  print("Launching Gradio interface...") # Debug log
543
  # Launch the Gradio interface without showing the API or sharing externally