TischEins commited on
Commit
a631daa
·
verified ·
1 Parent(s): 7e4f7b0

Upload 3 files

Browse files
Files changed (2) hide show
  1. app.py +1 -373
  2. requirements.txt +1 -2
app.py CHANGED
@@ -1,373 +1 @@
1
-
2
- import gradio as gr
3
- import pandas as pd
4
- import random
5
- import json
6
-
7
- camera_lens_map = {
8
- "Canon EOS R5": [
9
- "Canon RF 50mm f/1.2L USM",
10
- "Canon RF 35mm f/1.8 IS Macro STM",
11
- "Canon RF 85mm f/1.2L USM"
12
- ],
13
- "Canon EOS R3": [
14
- "Canon RF 24-70mm f/2.8L IS USM",
15
- "Canon RF 50mm f/1.2L USM",
16
- "Canon RF 85mm f/1.2L USM"
17
- ],
18
- "Nikon Z8": [
19
- "Nikon Z 50mm f/1.2 S",
20
- "Nikon Z 85mm f/1.8 S",
21
- "Nikon Z 24-70mm f/2.8 S"
22
- ],
23
- "Nikon Z9": [
24
- "Nikon Z 70-200mm f/2.8 VR S",
25
- "Nikon Z 24-120mm f/4 S",
26
- "Nikon Z 50mm f/1.8 S"
27
- ],
28
- "Sony Alpha 7R V": [
29
- "Sony FE 85mm f/1.4 GM",
30
- "Sony FE 24-105mm f/4 G OSS",
31
- "Sony FE 50mm f/1.2 GM"
32
- ],
33
- "Sony Alpha 1": [
34
- "Sony FE 35mm f/1.4 GM",
35
- "Sony FE 50mm f/1.2 GM",
36
- "Sony FE 70-200mm f/2.8 GM OSS"
37
- ],
38
- "Fujifilm GFX 100 II": [
39
- "Fujifilm GF 80mm f/1.7 R WR",
40
- "Fujifilm GF 45mm f/2.8 R WR",
41
- "Fujifilm GF 110mm f/2 R LM WR"
42
- ],
43
- "Fujifilm X-T5": [
44
- "Fujinon XF 56mm f/1.2 R WR",
45
- "Fujinon XF 23mm f/1.4 R LM WR",
46
- "Fujinon XF 16-55mm f/2.8 R LM WR"
47
- ],
48
- "Leica M11": [
49
- "Leica Summilux-M 50mm f/1.4 ASPH",
50
- "Leica APO-Summicron-M 75mm f/2 ASPH",
51
- "Leica Elmarit-M 28mm f/2.8 ASPH"
52
- ],
53
- "Leica SL2-S": [
54
- "Leica APO-Summicron-SL 75mm f/2 ASPH",
55
- "Leica Vario-Elmar-SL 24-90mm f/2.8-4 ASPH",
56
- "Leica APO-Vario-Elmar-SL 90-280mm f/2.8-4"
57
- ],
58
- "Panasonic Lumix S5 II": [
59
- "Panasonic Lumix S Pro 24-70mm f/2.8",
60
- "Panasonic Lumix S Pro 50mm f/1.4",
61
- "Panasonic Lumix S 85mm f/1.8"
62
- ],
63
- "Panasonic GH6": [
64
- "Panasonic Leica DG Nocticron 42.5mm f/1.2",
65
- "Panasonic Lumix G X Vario 12-35mm f/2.8",
66
- "Panasonic Leica DG Summilux 25mm f/1.4"
67
- ],
68
- "Hasselblad X2D 100C": [
69
- "Hasselblad XCD 80mm f/1.9",
70
- "Hasselblad XCD 45mm f/2.8",
71
- "Hasselblad XCD 120mm f/3.5 Macro"
72
- ],
73
- "Olympus OM-1": [
74
- "Olympus M.Zuiko 25mm f/1.2 PRO",
75
- "Olympus M.Zuiko 45mm f/1.2 PRO",
76
- "Olympus M.Zuiko 12-100mm f/4 IS PRO"
77
- ],
78
- "Olympus PEN-F": [
79
- "Olympus M.Zuiko 17mm f/1.8",
80
- "Olympus M.Zuiko 45mm f/1.8",
81
- "Olympus M.Zuiko 25mm f/1.8"
82
- ],
83
- "Pentax K-1 Mark II": [
84
- "Pentax D FA* 50mm f/1.4 SDM AW",
85
- "Pentax D FA 24-70mm f/2.8 SDM AW",
86
- "Pentax D FA 100mm f/2.8 Macro"
87
- ],
88
- "Pentax 645Z": [
89
- "Pentax FA 645 75mm f/2.8",
90
- "Pentax FA 645 45mm f/2.8",
91
- "Pentax FA 645 150mm f/2.8"
92
- ],
93
- "Sigma fp L": [
94
- "Sigma 35mm f/1.4 DG DN Art",
95
- "Sigma 45mm f/2.8 DG DN Contemporary",
96
- "Sigma 85mm f/1.4 DG DN Art"
97
- ],
98
- "GoPro Hero 12 Black": [
99
- "GoPro Standard Lens",
100
- "GoPro Max Lens Mod",
101
- "GoPro Dive Lens Mod"
102
- ],
103
- "Blackmagic Pocket Cinema Camera 6K Pro": [
104
- "Sigma 18-35mm f/1.8 Art",
105
- "Canon EF 50mm f/1.2L",
106
- "Zeiss CP.3 85mm T2.1"
107
- ]
108
- }
109
- camera_film_map = {
110
- "Canon EOS R5": [
111
- "Kodak Portra 400",
112
- "Kodak Ektar 100",
113
- "Kodak Gold 200"
114
- ],
115
- "Canon EOS R3": [
116
- "Cinestill 800T",
117
- "Kodak Vision3 500T",
118
- "Fujifilm Pro 400H"
119
- ],
120
- "Nikon Z8": [
121
- "Cinestill 800T",
122
- "Kodak Tri-X 400",
123
- "Fujifilm Superia X-TRA 400"
124
- ],
125
- "Nikon Z9": [
126
- "Fujifilm Pro 400H",
127
- "Kodak Ektar 100",
128
- "Kodak Ultramax 400"
129
- ],
130
- "Sony Alpha 7R V": [
131
- "Agfa Vista 200",
132
- "Kodak Ultramax 400",
133
- "Fujifilm C200"
134
- ],
135
- "Sony Alpha 1": [
136
- "Kodak Portra 800",
137
- "Kodak Gold 200",
138
- "Fujifilm Velvia 50"
139
- ],
140
- "Fujifilm GFX 100 II": [
141
- "Fujifilm Provia 100F",
142
- "Fujifilm Velvia 50",
143
- "Fujifilm Pro 400H"
144
- ],
145
- "Fujifilm X-T5": [
146
- "Fujifilm Pro 160NS",
147
- "Kodak Elite Chrome 100",
148
- "Fujifilm Natura 1600"
149
- ],
150
- "Leica M11": [
151
- "Ilford HP5 Plus",
152
- "Kodak T-Max 100",
153
- "AgfaPhoto APX 100"
154
- ],
155
- "Leica SL2-S": [
156
- "Lomography Metropolis 100-400",
157
- "Kodak Vision3 250D",
158
- "Rollei Vario Chrome 320"
159
- ],
160
- "Panasonic Lumix S5 II": [
161
- "Kodak Vision3 500T",
162
- "CineStill 800T",
163
- "Kodak Pro Image 100"
164
- ],
165
- "Panasonic GH6": [
166
- "Kodak Aerocolor IV 125",
167
- "Kodak Ektachrome E100",
168
- "Fujifilm Neopan 100"
169
- ],
170
- "Hasselblad X2D 100C": [
171
- "Kodak Elite Chrome 100",
172
- "Kodak Vision3 500T",
173
- "Kodak Vision3 250D"
174
- ],
175
- "Olympus OM-1": [
176
- "Kodak Pro Image 100",
177
- "Ilford Delta 3200",
178
- "Fomapan 100 Classic"
179
- ],
180
- "Olympus PEN-F": [
181
- "Fujifilm Sensia 200",
182
- "Kodak Ektachrome 64T",
183
- "Kodak Supra 400"
184
- ],
185
- "Pentax K-1 Mark II": [
186
- "Adox Color Mission 200",
187
- "Ferrania P30 Alpha",
188
- "Rollei Retro 400S"
189
- ],
190
- "Pentax 645Z": [
191
- "Kodak Panatomic-X",
192
- "Agfa Portrait XPS 160",
193
- "Kodak Vericolor III"
194
- ],
195
- "Sigma fp L": [
196
- "Ferrania P30 Alpha",
197
- "Cinestill BwXX",
198
- "Kodak Portra 800"
199
- ],
200
- "GoPro Hero 12 Black": [
201
- "Polaroid Originals Color i-Type",
202
- "Fujifilm Instax Mini Film",
203
- "Impossible Project B&W Film"
204
- ],
205
- "Blackmagic Pocket Cinema Camera 6K Pro": [
206
- "Kodak Vision3 500T",
207
- "Kodak Vision3 250D",
208
- "Fujifilm Eterna 250D"
209
- ]
210
- }
211
- light_conditions = [
212
- "Golden Hour",
213
- "Blue Hour",
214
- "Backlighting",
215
- "Overcast Light",
216
- "High Noon Sunlight",
217
- "Twilight Glow",
218
- "Morning Fog",
219
- "Studio Lighting",
220
- "Soft Ambient Light",
221
- "Window Light",
222
- "Dappled Light",
223
- "Hard Shadow",
224
- "Spotlight",
225
- "Stage Lighting",
226
- "Silhouette Light",
227
- "Fluorescent Light",
228
- "Candlelight",
229
- "Moonlight",
230
- "Streetlight Glow",
231
- "Reflected Light"
232
- ]
233
- mj_versions = ["6", "6.1", "7"]
234
- scene_variations = [
235
- "with dramatic lens flare",
236
- "with soft bokeh background",
237
- "with rich cinematic contrast",
238
- "with muted pastel tones",
239
- "with vibrant color pop",
240
- "with deep shadows",
241
- "with high-key brightness",
242
- "with low-key mood",
243
- "with subtle grain texture",
244
- "with glossy reflections",
245
- "with backlit rim light",
246
- "with fine detail sharpness",
247
- "with wide-angle perspective",
248
- "with telephoto compression",
249
- "with macro-level close-up",
250
- "with panoramic scope",
251
- "with dreamy glow",
252
- "with crisp clarity",
253
- "with vintage film grain",
254
- "with modern hyperrealism"
255
- ]
256
- presets = {
257
- "Sunset Portrait": {
258
- "camera": "Canon EOS R5",
259
- "lens": "Canon RF 50mm f/1.2L USM",
260
- "film": "Kodak Portra 400",
261
- "light": "Golden Hour",
262
- "scene": "A woman standing in a field of tall grass during sunset, soft wind in her hair",
263
- "version": "7"
264
- },
265
- "Urban Streetstyle": {
266
- "camera": "Sony Alpha 7R V",
267
- "lens": "Sony FE 85mm f/1.4 GM",
268
- "film": "Kodak Ultramax 400",
269
- "light": "Backlighting",
270
- "scene": "Young man walking through a neon-lit city street at night with glowing billboards",
271
- "version": "6.1"
272
- },
273
- "Forest Fantasy": {
274
- "camera": "Fujifilm GFX 100 II",
275
- "lens": "Fujifilm GF 80mm f/1.7 R WR",
276
- "film": "Fujifilm Provia 100F",
277
- "light": "Diffused Light",
278
- "scene": "A mysterious elf walking through a foggy forest with glowing mushrooms",
279
- "version": "6"
280
- },
281
- "Classic Black and White": {
282
- "camera": "Leica M11",
283
- "lens": "Leica Summilux-M 50mm f/1.4 ASPH",
284
- "film": "Ilford HP5 Plus",
285
- "light": "Soft Ambient Light",
286
- "scene": "Man reading newspaper in a Parisian caf\u00e9, 1950s",
287
- "version": "7"
288
- }
289
- }
290
-
291
- def apply_preset(p):
292
- pre = presets[p]
293
- return pre["camera"], pre["lens"], pre["film"], pre["light"], pre["scene"], pre["version"]
294
-
295
- def update_lens(camera):
296
- return gr.update(choices=camera_lens_map.get(camera, []), value=camera_lens_map[camera][0])
297
-
298
- def update_film(camera):
299
- return gr.update(choices=camera_film_map.get(camera, []), value=camera_film_map[camera][0])
300
-
301
- def generate_midjourney(camera, lens, film, light, mj_version, aspect_ratio, quality, stylize, seed, base_scene, num):
302
- prompts = []
303
- vars = random.sample(scene_variations, min(len(scene_variations), num))
304
- for i in range(num):
305
- scene = f"{base_scene}, {vars[i]}"
306
- mj_args = f"--ar {aspect_ratio} --q {quality} --s {stylize}"
307
- if seed: mj_args += f" --seed {seed}"
308
- prompts.append(f"{scene}, shot with {camera} and {lens}, using {film} film, under {light} {mj_args} --v {mj_version}")
309
- return "\n".join(prompts), prompts
310
-
311
- def generate_sora(camera, lens, film, light, base_scene):
312
- var = random.choice(scene_variations)
313
- scene = f"{base_scene}, {var}"
314
- prompt = f"A detailed scene of {scene}, captured using a {camera} and {lens}, simulated with {film} film look and {light} lighting."
315
- return prompt, [prompt]
316
-
317
- def export_txt(prompts):
318
- with open("prompts.txt", "w") as f:
319
- f.write("\n".join(prompts))
320
- return gr.File.update(value="prompts.txt")
321
-
322
- def export_csv(prompts):
323
- df = pd.DataFrame({"Prompt": prompts})
324
- df.to_csv("prompts.csv", index=False)
325
- return gr.File.update(value="prompts.csv")
326
-
327
- with gr.Blocks() as demo:
328
- gr.Markdown("## TischEins.org | Midjourney Prompt Engine\nPro Studio Prompt Generator for Midjourney and Sora")
329
-
330
- preset = gr.Dropdown(choices=list(presets.keys()), value=list(presets.keys())[0], label="Select Preset")
331
- camera = gr.Dropdown(choices=list(camera_lens_map.keys()), value=presets[list(presets.keys())[0]]["camera"], label="Camera Model")
332
- lens = gr.Dropdown(choices=camera_lens_map[camera.value], value=presets[list(presets.keys())[0]]["lens"], label="Lens Model")
333
- film = gr.Dropdown(choices=camera_film_map[camera.value], value=presets[list(presets.keys())[0]]["film"], label="Color Film Type")
334
- light = gr.Dropdown(choices=light_conditions, value=presets[list(presets.keys())[0]]["light"], label="Light Condition")
335
-
336
- with gr.Tab("Midjourney"):
337
- mj_version = gr.Dropdown(choices=mj_versions, value=presets[list(presets.keys())[0]]["version"], label="Midjourney Version")
338
- aspect_ratio = gr.Textbox(label="Aspect Ratio", value="5:4")
339
- quality = gr.Textbox(label="Quality", value="2")
340
- stylize = gr.Textbox(label="Stylize", value="0")
341
- seed = gr.Textbox(label="Seed (optional)")
342
- num = gr.Slider(1,50,value=3,label="Number of Prompts")
343
- out_mid = gr.Textbox(lines=10, label="Generated Prompts")
344
- state_mid = gr.State([])
345
-
346
- btn_mid = gr.Button("Generate")
347
- btn_mid.click(fn=generate_midjourney,
348
- inputs=[camera, lens, film, light, mj_version, aspect_ratio, quality, stylize, seed, presets[preset.value]["scene"], num],
349
- outputs=[out_mid, state_mid])
350
- txt_mid = gr.Button("Export TXT"); csv_mid = gr.Button("Export CSV")
351
- dl_txt_mid = gr.File(visible=False); dl_csv_mid = gr.File(visible=False)
352
- txt_mid.click(fn=export_txt, inputs=state_mid, outputs=dl_txt_mid)
353
- csv_mid.click(fn=export_csv, inputs=state_mid, outputs=dl_csv_mid)
354
-
355
- with gr.Tab("ChatGPT Sora"):
356
- out_s = gr.Textbox(lines=10, label="Generated Prompt")
357
- state_s = gr.State([])
358
- btn_s = gr.Button("Generate")
359
- btn_s.click(fn=generate_sora,
360
- inputs=[camera, lens, film, light, presets[preset.value]["scene"]],
361
- outputs=[out_s, state_s])
362
- txt_s = gr.Button("Export TXT"); csv_s = gr.Button("Export CSV")
363
- dl_txt_s = gr.File(visible=False); dl_csv_s = gr.File(visible=False)
364
- txt_s.click(fn=export_txt, inputs=state_s, outputs=dl_txt_s)
365
- csv_s.click(fn=export_csv, inputs=state_s, outputs=dl_csv_s)
366
-
367
- camera.change(fn=update_lens, inputs=camera, outputs=lens)
368
- camera.change(fn=update_film, inputs=camera, outputs=film)
369
- preset.change(fn=apply_preset, inputs=preset, outputs=[camera, lens, film, light, None, mj_version])
370
-
371
- gr.Markdown('<a href="https://tischeins.org">Pro Studio Mode by TischEins.org</a>')
372
-
373
- demo.launch()
 
1
+ # Placeholder
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,2 +1 @@
1
- gradio
2
- pandas
 
1
+ # Placeholder