Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +77 -228
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
import pandas as pd
|
|
|
|
| 4 |
|
| 5 |
camera_lens_map = {
|
| 6 |
"Canon EOS R5": [
|
|
@@ -8,11 +10,6 @@ camera_lens_map = {
|
|
| 8 |
"Canon RF 35mm f/1.8 IS Macro STM",
|
| 9 |
"Canon RF 85mm f/1.2L USM"
|
| 10 |
],
|
| 11 |
-
"Nikon Z8": [
|
| 12 |
-
"Nikon Z 50mm f/1.2 S",
|
| 13 |
-
"Nikon Z 85mm f/1.8 S",
|
| 14 |
-
"Nikon Z 24-70mm f/2.8 S"
|
| 15 |
-
],
|
| 16 |
"Sony Alpha 7R V": [
|
| 17 |
"Sony FE 85mm f/1.4 GM",
|
| 18 |
"Sony FE 24-70mm f/2.8 GM II",
|
|
@@ -27,81 +24,6 @@ camera_lens_map = {
|
|
| 27 |
"Leica Summilux-M 50mm f/1.4 ASPH",
|
| 28 |
"Leica APO-Summicron-M 75mm f/2 ASPH",
|
| 29 |
"Leica Elmarit-M 28mm f/2.8 ASPH"
|
| 30 |
-
],
|
| 31 |
-
"Panasonic Lumix S5II": [
|
| 32 |
-
"Panasonic Lumix S Pro 50mm f/1.4",
|
| 33 |
-
"Sigma 35mm f/1.4 DG DN",
|
| 34 |
-
"Panasonic Lumix S 85mm f/1.8"
|
| 35 |
-
],
|
| 36 |
-
"Olympus OM-D E-M1 Mark III": [
|
| 37 |
-
"Olympus M.Zuiko Digital ED 45mm f/1.2 PRO",
|
| 38 |
-
"Olympus M.Zuiko Digital ED 25mm f/1.2 PRO",
|
| 39 |
-
"Olympus M.Zuiko Digital ED 12-40mm f/2.8 PRO"
|
| 40 |
-
],
|
| 41 |
-
"Pentax K-3 Mark III": [
|
| 42 |
-
"HD Pentax-D FA* 50mm f/1.4 SDM AW",
|
| 43 |
-
"HD Pentax-DA 16-85mm f/3.5-5.6 ED DC WR",
|
| 44 |
-
"HD Pentax-D FA 70-210mm f/4 ED SDM WR"
|
| 45 |
-
],
|
| 46 |
-
"Canon EOS 5D Mark IV": [
|
| 47 |
-
"Canon EF 24-70mm f/2.8L II USM",
|
| 48 |
-
"Canon EF 70-200mm f/2.8L IS III USM",
|
| 49 |
-
"Canon EF 50mm f/1.2L USM"
|
| 50 |
-
],
|
| 51 |
-
"Nikon D850": [
|
| 52 |
-
"Nikon AF-S NIKKOR 24-70mm f/2.8E ED VR",
|
| 53 |
-
"Nikon AF-S NIKKOR 105mm f/1.4E ED",
|
| 54 |
-
"Nikon AF-S 50mm f/1.8G"
|
| 55 |
-
],
|
| 56 |
-
"Sony A7 III": [
|
| 57 |
-
"Sony FE 35mm f/1.4 GM",
|
| 58 |
-
"Sony FE 70-200mm f/2.8 GM OSS",
|
| 59 |
-
"Tamron 28-75mm f/2.8 Di III RXD"
|
| 60 |
-
],
|
| 61 |
-
"Fujifilm X-T5": [
|
| 62 |
-
"Fujinon XF 23mm f/1.4 R LM WR",
|
| 63 |
-
"Fujinon XF 56mm f/1.2 R WR",
|
| 64 |
-
"Fujinon XF 16-55mm f/2.8 R LM WR"
|
| 65 |
-
],
|
| 66 |
-
"Leica Q2": [
|
| 67 |
-
"Leica Summilux 28mm f/1.7 ASPH (fixed)",
|
| 68 |
-
"Leica APO-Summicron 90mm f/2 ASPH",
|
| 69 |
-
"Leica Elmarit-M 21mm f/2.8 ASPH"
|
| 70 |
-
],
|
| 71 |
-
"Panasonic GH6": [
|
| 72 |
-
"Panasonic Leica DG 25mm f/1.4 II ASPH",
|
| 73 |
-
"Olympus M.Zuiko ED 75mm f/1.8",
|
| 74 |
-
"Panasonic Lumix 42.5mm f/1.7"
|
| 75 |
-
],
|
| 76 |
-
"Olympus PEN-F": [
|
| 77 |
-
"Olympus M.Zuiko 17mm f/1.8",
|
| 78 |
-
"Olympus M.Zuiko 45mm f/1.8",
|
| 79 |
-
"Olympus M.Zuiko 25mm f/1.8"
|
| 80 |
-
],
|
| 81 |
-
"Pentax 645Z": [
|
| 82 |
-
"Pentax D FA 645 55mm f/2.8 AL",
|
| 83 |
-
"Pentax FA 645 150mm f/2.8",
|
| 84 |
-
"Pentax FA 645 75mm f/2.8"
|
| 85 |
-
],
|
| 86 |
-
"Canon EOS R6 Mark II": [
|
| 87 |
-
"Canon RF 24-105mm f/4L IS USM",
|
| 88 |
-
"Canon RF 85mm f/2 Macro IS STM",
|
| 89 |
-
"Canon RF 70-200mm f/2.8L IS USM"
|
| 90 |
-
],
|
| 91 |
-
"Nikon Z9": [
|
| 92 |
-
"Nikon Z 24-120mm f/4 S",
|
| 93 |
-
"Nikon Z 400mm f/2.8 TC VR S",
|
| 94 |
-
"Nikon Z 70-200mm f/2.8 VR S"
|
| 95 |
-
],
|
| 96 |
-
"Sony FX3": [
|
| 97 |
-
"Sony FE 24mm f/1.4 GM",
|
| 98 |
-
"Sony FE PZ 28-135mm f/4 G OSS",
|
| 99 |
-
"Sigma 85mm f/1.4 DG DN Art"
|
| 100 |
-
],
|
| 101 |
-
"Fujifilm X-H2": [
|
| 102 |
-
"Fujinon XF 18mm f/1.4 R LM WR",
|
| 103 |
-
"Fujinon XF 33mm f/1.4 R LM WR",
|
| 104 |
-
"Fujinon XF 56mm f/1.2 R APD"
|
| 105 |
]
|
| 106 |
}
|
| 107 |
camera_film_map = {
|
|
@@ -110,11 +32,6 @@ camera_film_map = {
|
|
| 110 |
"Kodak Ektar 100",
|
| 111 |
"Kodak Gold 200"
|
| 112 |
],
|
| 113 |
-
"Nikon Z8": [
|
| 114 |
-
"Cinestill 800T",
|
| 115 |
-
"Kodak Tri-X 400",
|
| 116 |
-
"Fujifilm Superia X-TRA 400"
|
| 117 |
-
],
|
| 118 |
"Sony Alpha 7R V": [
|
| 119 |
"Agfa Vista 200",
|
| 120 |
"Kodak Ultramax 400",
|
|
@@ -129,81 +46,6 @@ camera_film_map = {
|
|
| 129 |
"Ilford HP5 Plus",
|
| 130 |
"Kodak T-Max 100",
|
| 131 |
"AgfaPhoto APX 100"
|
| 132 |
-
],
|
| 133 |
-
"Panasonic Lumix S5II": [
|
| 134 |
-
"Kodak Vision3 500T",
|
| 135 |
-
"Cinestill 50D",
|
| 136 |
-
"Kodak Gold 200"
|
| 137 |
-
],
|
| 138 |
-
"Olympus OM-D E-M1 Mark III": [
|
| 139 |
-
"Kodak Ektachrome E100",
|
| 140 |
-
"Fujifilm Neopan 100",
|
| 141 |
-
"Kodak ColorPlus 200"
|
| 142 |
-
],
|
| 143 |
-
"Pentax K-3 Mark III": [
|
| 144 |
-
"Ilford Delta 3200",
|
| 145 |
-
"Fomapan 100 Classic",
|
| 146 |
-
"Rollei Retro 400S"
|
| 147 |
-
],
|
| 148 |
-
"Canon EOS 5D Mark IV": [
|
| 149 |
-
"Kodak Pro Image 100",
|
| 150 |
-
"Kodak Vision3 250D",
|
| 151 |
-
"Fujicolor 100"
|
| 152 |
-
],
|
| 153 |
-
"Nikon D850": [
|
| 154 |
-
"AgfaPhoto Vista plus 400",
|
| 155 |
-
"Fujicolor Industrial 100",
|
| 156 |
-
"Kodak T-Max 400"
|
| 157 |
-
],
|
| 158 |
-
"Sony A7 III": [
|
| 159 |
-
"Cinestill BwXX",
|
| 160 |
-
"Kodak Gold 100",
|
| 161 |
-
"Fujifilm Natura 1600"
|
| 162 |
-
],
|
| 163 |
-
"Fujifilm X-T5": [
|
| 164 |
-
"Fujifilm Pro 160NS",
|
| 165 |
-
"Kodak Elite Chrome 100",
|
| 166 |
-
"Fujifilm Fortia SP"
|
| 167 |
-
],
|
| 168 |
-
"Leica Q2": [
|
| 169 |
-
"Ilford XP2 Super 400",
|
| 170 |
-
"Kodak ColorPlus 100",
|
| 171 |
-
"Fujicolor Press 800"
|
| 172 |
-
],
|
| 173 |
-
"Panasonic GH6": [
|
| 174 |
-
"Agfa Scala 200x",
|
| 175 |
-
"Kodak High-Speed Infrared",
|
| 176 |
-
"Rollei Vario Chrome"
|
| 177 |
-
],
|
| 178 |
-
"Olympus PEN-F": [
|
| 179 |
-
"Fujifilm Sensia 200",
|
| 180 |
-
"Kodak Ektachrome 64T",
|
| 181 |
-
"Kodak Supra 400"
|
| 182 |
-
],
|
| 183 |
-
"Pentax 645Z": [
|
| 184 |
-
"Kodak Panatomic-X",
|
| 185 |
-
"Agfa Portrait XPS 160",
|
| 186 |
-
"Kodak Vericolor III"
|
| 187 |
-
],
|
| 188 |
-
"Canon EOS R6 Mark II": [
|
| 189 |
-
"Kodak Vision3 200T",
|
| 190 |
-
"Kodak Gold 400",
|
| 191 |
-
"Ilford Pan F Plus 50"
|
| 192 |
-
],
|
| 193 |
-
"Nikon Z9": [
|
| 194 |
-
"Fujifilm Velvia 100",
|
| 195 |
-
"Kodak Ektachrome 160",
|
| 196 |
-
"Ilford Delta 100"
|
| 197 |
-
],
|
| 198 |
-
"Sony FX3": [
|
| 199 |
-
"Kodak Vision3 500D",
|
| 200 |
-
"Cinestill 400D",
|
| 201 |
-
"Fujifilm Provia 400X"
|
| 202 |
-
],
|
| 203 |
-
"Fujifilm X-H2": [
|
| 204 |
-
"Kodak Technical Pan",
|
| 205 |
-
"AgfaPhoto CT Precisa 100",
|
| 206 |
-
"Fujifilm Velvia 100F"
|
| 207 |
]
|
| 208 |
}
|
| 209 |
light_conditions = [
|
|
@@ -263,34 +105,54 @@ presets = {
|
|
| 263 |
"version": "7"
|
| 264 |
}
|
| 265 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
|
| 267 |
-
def
|
| 268 |
return gr.update(choices=camera_lens_map[camera], value=camera_lens_map[camera][0])
|
| 269 |
|
| 270 |
-
def
|
| 271 |
return gr.update(choices=camera_film_map[camera], value=camera_film_map[camera][0])
|
| 272 |
|
| 273 |
-
def
|
| 274 |
-
|
| 275 |
-
return [gr.update(visible=visible)] * 4
|
| 276 |
-
|
| 277 |
-
def apply_preset(preset_name):
|
| 278 |
-
preset = presets[preset_name]
|
| 279 |
return (
|
| 280 |
-
|
| 281 |
-
camera_lens_map[
|
| 282 |
-
camera_film_map[
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
)
|
| 287 |
|
| 288 |
-
def
|
| 289 |
-
mj_args = f"--ar {aspect_ratio} --q {quality} --s {stylize}"
|
| 290 |
-
if seed:
|
| 291 |
-
mj_args += f" --seed {seed}"
|
| 292 |
prompts = []
|
| 293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
if engine == "Midjourney":
|
| 295 |
prompt = f"{scene}, shot with {camera} and {lens}, using {film} film, under {light} {mj_args} --v {mj_version}"
|
| 296 |
else:
|
|
@@ -298,63 +160,50 @@ def generate_prompt(engine, mj_version, camera, lens, film, light, aspect_ratio,
|
|
| 298 |
prompts.append(prompt)
|
| 299 |
return "\n".join(prompts), prompts
|
| 300 |
|
| 301 |
-
def
|
| 302 |
-
with open("prompts.txt",
|
| 303 |
f.write("\n".join(prompts))
|
| 304 |
return gr.File.update(value="prompts.txt", visible=True)
|
| 305 |
|
| 306 |
-
def
|
| 307 |
-
df = pd.DataFrame({"Prompt":
|
| 308 |
df.to_csv("prompts.csv", index=False)
|
| 309 |
return gr.File.update(value="prompts.csv", visible=True)
|
| 310 |
|
| 311 |
with gr.Blocks() as demo:
|
| 312 |
gr.Markdown("# TischEins.org | Midjourney Prompt Engine")
|
| 313 |
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
engine_choice.change(fn=toggle_visibility, inputs=engine_choice, outputs=[
|
| 347 |
-
mj_version_dropdown, aspect_ratio, quality, stylize
|
| 348 |
-
])
|
| 349 |
-
|
| 350 |
-
generate_btn.click(fn=generate_prompt, inputs=[
|
| 351 |
-
engine_choice, mj_version_dropdown, camera_dropdown, lens_dropdown, film_dropdown,
|
| 352 |
-
light_dropdown, aspect_ratio, quality, stylize, seed, scene, num
|
| 353 |
-
], outputs=[output, prompts_state])
|
| 354 |
-
|
| 355 |
-
export_txt_btn.click(fn=export_to_txt, inputs=prompts_state, outputs=download_txt)
|
| 356 |
-
export_csv_btn.click(fn=export_to_csv, inputs=prompts_state, outputs=download_csv)
|
| 357 |
-
|
| 358 |
-
gr.Markdown('<a href="https://tischeins.org" target="_blank">Pro Studio Mode by TischEins.org</a>')
|
| 359 |
|
| 360 |
demo.launch()
|
|
|
|
| 1 |
|
| 2 |
import gradio as gr
|
| 3 |
+
import random
|
| 4 |
import pandas as pd
|
| 5 |
+
import json
|
| 6 |
|
| 7 |
camera_lens_map = {
|
| 8 |
"Canon EOS R5": [
|
|
|
|
| 10 |
"Canon RF 35mm f/1.8 IS Macro STM",
|
| 11 |
"Canon RF 85mm f/1.2L USM"
|
| 12 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
"Sony Alpha 7R V": [
|
| 14 |
"Sony FE 85mm f/1.4 GM",
|
| 15 |
"Sony FE 24-70mm f/2.8 GM II",
|
|
|
|
| 24 |
"Leica Summilux-M 50mm f/1.4 ASPH",
|
| 25 |
"Leica APO-Summicron-M 75mm f/2 ASPH",
|
| 26 |
"Leica Elmarit-M 28mm f/2.8 ASPH"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
]
|
| 28 |
}
|
| 29 |
camera_film_map = {
|
|
|
|
| 32 |
"Kodak Ektar 100",
|
| 33 |
"Kodak Gold 200"
|
| 34 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
"Sony Alpha 7R V": [
|
| 36 |
"Agfa Vista 200",
|
| 37 |
"Kodak Ultramax 400",
|
|
|
|
| 46 |
"Ilford HP5 Plus",
|
| 47 |
"Kodak T-Max 100",
|
| 48 |
"AgfaPhoto APX 100"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
]
|
| 50 |
}
|
| 51 |
light_conditions = [
|
|
|
|
| 105 |
"version": "7"
|
| 106 |
}
|
| 107 |
}
|
| 108 |
+
scene_variations = [
|
| 109 |
+
"with dramatic lens flare",
|
| 110 |
+
"with soft bokeh background",
|
| 111 |
+
"with rich cinematic contrast",
|
| 112 |
+
"with muted pastel tones",
|
| 113 |
+
"with vibrant color pop",
|
| 114 |
+
"with deep shadows",
|
| 115 |
+
"with high-key brightness",
|
| 116 |
+
"with low-key mood",
|
| 117 |
+
"with subtle grain texture",
|
| 118 |
+
"with glossy reflections",
|
| 119 |
+
"with backlit rim light",
|
| 120 |
+
"with fine detail sharpness",
|
| 121 |
+
"with wide-angle perspective",
|
| 122 |
+
"with telephoto compression",
|
| 123 |
+
"with macro-level close-up",
|
| 124 |
+
"with panoramic scope",
|
| 125 |
+
"with dreamy glow",
|
| 126 |
+
"with crisp clarity",
|
| 127 |
+
"with vintage film grain",
|
| 128 |
+
"with modern hyperrealism"
|
| 129 |
+
]
|
| 130 |
|
| 131 |
+
def update_lens(camera):
|
| 132 |
return gr.update(choices=camera_lens_map[camera], value=camera_lens_map[camera][0])
|
| 133 |
|
| 134 |
+
def update_film(camera):
|
| 135 |
return gr.update(choices=camera_film_map[camera], value=camera_film_map[camera][0])
|
| 136 |
|
| 137 |
+
def apply_preset(p):
|
| 138 |
+
pre = presets[p]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
return (
|
| 140 |
+
pre["camera"],
|
| 141 |
+
camera_lens_map[pre["camera"]][0],
|
| 142 |
+
camera_film_map[pre["camera"]][0],
|
| 143 |
+
pre["light"],
|
| 144 |
+
pre["scene"],
|
| 145 |
+
pre["version"]
|
| 146 |
)
|
| 147 |
|
| 148 |
+
def generate_prompts(engine, mj_version, camera, lens, film, light, aspect_ratio, quality, stylize, seed, base_scene, num):
|
|
|
|
|
|
|
|
|
|
| 149 |
prompts = []
|
| 150 |
+
# choose variations
|
| 151 |
+
vars = random.sample(scene_variations, min(num, len(scene_variations)))
|
| 152 |
+
for i in range(num):
|
| 153 |
+
scene = f"{base_scene}, {vars[i]}"
|
| 154 |
+
mj_args = f"--ar {aspect_ratio} --q {quality} --s {stylize}"
|
| 155 |
+
if seed: mj_args += f" --seed {seed}"
|
| 156 |
if engine == "Midjourney":
|
| 157 |
prompt = f"{scene}, shot with {camera} and {lens}, using {film} film, under {light} {mj_args} --v {mj_version}"
|
| 158 |
else:
|
|
|
|
| 160 |
prompts.append(prompt)
|
| 161 |
return "\n".join(prompts), prompts
|
| 162 |
|
| 163 |
+
def export_txt(prompts):
|
| 164 |
+
with open("prompts.txt","w") as f:
|
| 165 |
f.write("\n".join(prompts))
|
| 166 |
return gr.File.update(value="prompts.txt", visible=True)
|
| 167 |
|
| 168 |
+
def export_csv(prompts):
|
| 169 |
+
df = pd.DataFrame({"Prompt":prompts})
|
| 170 |
df.to_csv("prompts.csv", index=False)
|
| 171 |
return gr.File.update(value="prompts.csv", visible=True)
|
| 172 |
|
| 173 |
with gr.Blocks() as demo:
|
| 174 |
gr.Markdown("# TischEins.org | Midjourney Prompt Engine")
|
| 175 |
|
| 176 |
+
psel = gr.Dropdown(choices=list(presets.keys()), label="Select Preset")
|
| 177 |
+
eng = gr.Radio(["Midjourney","ChatGPT Sora"], label="Engine", value="Midjourney")
|
| 178 |
+
mjv = gr.Dropdown(choices=mj_versions, label="MJ Version", value="7", visible=True)
|
| 179 |
+
cam = gr.Dropdown(choices=list(camera_lens_map.keys()), label="Camera Model")
|
| 180 |
+
len_ = gr.Dropdown(choices=[], label="Lens Model")
|
| 181 |
+
film = gr.Dropdown(choices=[], label="Color Film Type")
|
| 182 |
+
light = gr.Dropdown(choices=light_conditions, label="Light Condition")
|
| 183 |
+
ar = gr.Textbox(label="Aspect Ratio", value="5:4", visible=True)
|
| 184 |
+
q = gr.Textbox(label="Quality", value="2", visible=True)
|
| 185 |
+
s = gr.Textbox(label="Stylize", value="0", visible=True)
|
| 186 |
+
seed = gr.Textbox(label="Seed", placeholder="optional")
|
| 187 |
+
base_scene = gr.Textbox(label="Scene Description")
|
| 188 |
+
num = gr.Slider(1,50,value=3,label="Number of Prompts")
|
| 189 |
+
out = gr.Textbox(label="Prompts", lines=20)
|
| 190 |
+
state = gr.State([])
|
| 191 |
+
|
| 192 |
+
psel.change(fn=apply_preset, inputs=psel, outputs=[cam,len_,film,light,base_scene,mjv])
|
| 193 |
+
cam.change(fn=update_lens, inputs=cam, outputs=len_)
|
| 194 |
+
cam.change(fn=update_film, inputs=cam, outputs=film)
|
| 195 |
+
eng.change(lambda e: [gr.update(visible=e=="Midjourney")]*3, inputs=eng, outputs=[mjv,ar,q,s])
|
| 196 |
+
|
| 197 |
+
btn = gr.Button("Generate")
|
| 198 |
+
btn.click(fn=generate_prompts, inputs=[eng,mjv,cam,len_,film,light,ar,q,s,seed,base_scene,num], outputs=[out,state])
|
| 199 |
+
|
| 200 |
+
txt_btn = gr.Button("Export TXT")
|
| 201 |
+
csv_btn = gr.Button("Export CSV")
|
| 202 |
+
dl_txt = gr.File(visible=False)
|
| 203 |
+
dl_csv = gr.File(visible=False)
|
| 204 |
+
txt_btn.click(fn=export_txt, inputs=state, outputs=dl_txt)
|
| 205 |
+
csv_btn.click(fn=export_csv, inputs=state, outputs=dl_csv)
|
| 206 |
+
|
| 207 |
+
gr.Markdown('<a href="https://tischeins.org">Pro Studio Mode by TischEins.org</a>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
gradio
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
+
pandas
|