charliebaby2023 commited on
Commit
0318f31
1 Parent(s): 41c7400

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -64
app.py CHANGED
@@ -3,29 +3,19 @@ from random import randint
3
  from all_models import models
4
  from datetime import datetime
5
 
 
 
6
 
7
-
8
-
9
- now2=0
10
-
11
- #kii = "nude femboy sissy with small penis, bound anal sex orgy party, perfect penis, oral sex, threesum, head between thighs, glans inside mouth, cuming from glans"
12
- #kii = "score_9, score_8_up, score_7_up, absurdres, 1femboy, long blonde hair, thin, skinny, full body image, lithe, young, blue eyes, glasses, small, tiny, flat chest, little, short, femboy body, nude, mouth open, penis, peeing from glans, peeing in mouth, veiny penis, veins, barefoot, feet, wet, peeing from glans, wet body, wet feet, wet hair, wet body, bathroom, bathroom background, pee, peeing, pissing, sex, anal, anal sex, fucking, precum, pee, peeing, pissing, precum, man with femboy, man fucking femboy, man having with femboy, fucking, femboy being anal man, cowgirl sex position, cowgirl anal, cowgirl position, legs up, feet up, 2 boys, cinematic lighting, dramatic angle, volumetric lighting, peeing from glans"
13
- #kii= "2characters, interracial, BREAK ,(1man black nude standing peeing from glans, peeing into mouth), BREAK ,(1femboy white nude kneeling, tiny penis, medium breasts, nipples pierced, blindfolded, legs spread, pee dripping from chin, mouth wide open, leather collar, chain leash), realisitic human textures,"
14
- kii="men and femboys crawling, anal oral group sex orgy, pulling anus open with fingers, men laying on bed, glans in mouth, tiny penis, large testicles, long flowing hair, perfect hands, perfect fingers, fingers in anus, cumming from glans, blowjob, topless"
15
-
16
  def get_current_time():
17
  now = datetime.now()
18
- now2=now
19
  current_time = now2.strftime("%Y-%m-%d %H:%M:%S")
20
-
21
- ki=f'{kii} {current_time}'
22
  return ki
23
 
24
-
25
  def load_fn(models):
26
  global models_load
27
  models_load = {}
28
-
29
  for model in models:
30
  if model not in models_load.keys():
31
  try:
@@ -34,42 +24,31 @@ def load_fn(models):
34
  m = gr.Interface(lambda txt: None, ['text'], ['image'])
35
  models_load.update({model: m})
36
 
37
-
38
-
39
  load_fn(models)
40
 
41
-
42
  num_models = len(models)
43
  default_models = models[:num_models]
44
 
45
-
46
-
47
  def extend_choices(choices):
48
  return choices + (num_models - len(choices)) * ['NA']
49
 
50
-
51
  def update_imgbox(choices):
52
  choices_plus = extend_choices(choices)
53
- return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
54
 
55
-
56
  def gen_fn(model_str, prompt):
57
  if model_str == 'NA':
58
  return None
59
  noise = str(randint(0, 9999))
60
-
61
  return models_load[model_str](f'{prompt} {noise}')
62
 
63
-
64
-
65
  def make_me():
66
  with gr.Tab('The Dream'):
67
- txt_input = gr.Textbox(label = 'Your prompt:', lines=4, value=kii ).style(container=False,min_width=600,min_height=300)
68
- gen_button = gr.Button('Generate up to 6 images in up to 3 minutes total').style(max_width=400,max_height=200)
69
- stop_button = gr.Button('Stop', variant = 'secondary', interactive = False).style(max_width=400,max_height=200)
70
- gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
71
- gr.HTML(
72
- """
73
  <div style="text-align: center; max-width: 1200px; margin: 0 auto;">
74
  <div>
75
  <body>
@@ -78,47 +57,41 @@ def make_me():
78
  </body>
79
  </div>
80
  </div>
81
- """
82
- )
83
  with gr.Row():
84
- output = [gr.Image(label = m, min_width=280) for m in default_models]
85
- current_models = [gr.Textbox(m, visible = False) for m in default_models]
86
-
87
  for m, o in zip(current_models, output):
88
  gen_event = gen_button.click(gen_fn, [m, txt_input], o)
89
- stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
90
  with gr.Accordion('Model selection'):
91
- model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models from the 800 available!', value = default_models, multiselect = True, max_choices = num_models, interactive = True, filterable = False)
92
  model_choice.change(update_imgbox, model_choice, output)
93
  model_choice.change(extend_choices, model_choice, current_models)
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
  with gr.Row():
104
- gr.HTML(
105
- """
106
- <div class="footer">
107
- <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77 and Omnibus's Maximum Multiplier!
108
- </p>
109
- """
110
- )
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  with gr.Blocks(css=".toast-wrap {position:absolute!important; bottom:0%!important; top:auto!important; display:none!important; }") as demo:
 
113
  make_me()
114
-
115
- demo.queue(concurrency_count = 200)
116
- demo.launch()
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
 
 
 
 
3
  from all_models import models
4
  from datetime import datetime
5
 
6
+ now2 = 0
7
+ kii = "dog"
8
 
 
 
 
 
 
 
 
 
 
9
  def get_current_time():
10
  now = datetime.now()
11
+ now2 = now
12
  current_time = now2.strftime("%Y-%m-%d %H:%M:%S")
13
+ ki = f'{kii} {current_time}'
 
14
  return ki
15
 
 
16
  def load_fn(models):
17
  global models_load
18
  models_load = {}
 
19
  for model in models:
20
  if model not in models_load.keys():
21
  try:
 
24
  m = gr.Interface(lambda txt: None, ['text'], ['image'])
25
  models_load.update({model: m})
26
 
 
 
27
  load_fn(models)
28
 
 
29
  num_models = len(models)
30
  default_models = models[:num_models]
31
 
 
 
32
  def extend_choices(choices):
33
  return choices + (num_models - len(choices)) * ['NA']
34
 
 
35
  def update_imgbox(choices):
36
  choices_plus = extend_choices(choices)
37
+ return [gr.Image(None, label=m, visible=(m != 'NA')) for m in choices_plus]
38
 
 
39
  def gen_fn(model_str, prompt):
40
  if model_str == 'NA':
41
  return None
42
  noise = str(randint(0, 9999))
 
43
  return models_load[model_str](f'{prompt} {noise}')
44
 
 
 
45
  def make_me():
46
  with gr.Tab('The Dream'):
47
+ txt_input = gr.Textbox(label='Your prompt:', lines=4, value=kii).style(container=False, min_width=600, min_height=300)
48
+ gen_button = gr.Button('Generate up to 6 images in up to 3 minutes total').style(max_width=400, max_height=200)
49
+ stop_button = gr.Button('Stop', variant='secondary', interactive=False).style(max_width=400, max_height=200)
50
+ gen_button.click(lambda s: gr.update(interactive=True), None, stop_button)
51
+ gr.HTML("""
 
52
  <div style="text-align: center; max-width: 1200px; margin: 0 auto;">
53
  <div>
54
  <body>
 
57
  </body>
58
  </div>
59
  </div>
60
+ """)
 
61
  with gr.Row():
62
+ output = [gr.Image(label=m, min_width=280) for m in default_models]
63
+ current_models = [gr.Textbox(m, visible=False) for m in default_models]
 
64
  for m, o in zip(current_models, output):
65
  gen_event = gen_button.click(gen_fn, [m, txt_input], o)
66
+ stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
67
  with gr.Accordion('Model selection'):
68
+ model_choice = gr.CheckboxGroup(models, label=f'Choose up to {num_models} different models from the 800 available!', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
69
  model_choice.change(update_imgbox, model_choice, output)
70
  model_choice.change(extend_choices, model_choice, current_models)
 
 
 
 
 
 
 
 
 
71
  with gr.Row():
72
+ gr.HTML("""
73
+ <div class="footer">
74
+ <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77 and Omnibus's Maximum Multiplier!
75
+ </p>
76
+ """)
77
+
78
+ # Custom JavaScript to prevent auto-scrolling on error toast
79
+ js_code = """
80
+ document.addEventListener('DOMContentLoaded', function() {
81
+ const observer = new MutationObserver(function(mutations) {
82
+ for (let mutation of mutations) {
83
+ if (mutation.addedNodes.length && mutation.addedNodes[0].classList.contains('alert')) {
84
+ window.scrollTo({top: window.scrollY});
85
+ }
86
+ }
87
+ });
88
+ observer.observe(document.body, { childList: true, subtree: true });
89
+ });
90
+ """
91
 
92
  with gr.Blocks(css=".toast-wrap {position:absolute!important; bottom:0%!important; top:auto!important; display:none!important; }") as demo:
93
+ gr.Markdown("<script>" + js_code + "</script>")
94
  make_me()
 
 
 
 
 
 
 
 
 
 
95
 
96
+ demo.queue(concurrency_count=200)
97
+ demo.launch()