Brian Watson commited on
Commit
d9ea998
1 Parent(s): 12632a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -34
app.py CHANGED
@@ -48,7 +48,7 @@ models = [
48
 
49
  current_model = models[0]
50
 
51
- text_gen = gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link")
52
 
53
  models2 = []
54
  for model in models:
@@ -64,7 +64,7 @@ def text_it(inputs, text_gen=text_gen):
64
  def set_model(current_model_index):
65
  global current_model
66
  current_model = models[current_model_index]
67
- return gr.update(label=f"{current_model['name']}")
68
 
69
 
70
  def send_it(inputs, model_choice):
@@ -72,16 +72,14 @@ def send_it(inputs, model_choice):
72
  return proc(inputs)
73
 
74
 
75
- css = """"""
76
-
77
- with gr.Blocks(css=css) as myface:
78
  gr.HTML(
79
 
80
  )
81
 
82
  with gr.Row():
83
  with gr.Row():
84
- input_text = gr.Textbox(label="Prompt idea", lines=1)
85
  # Model selection dropdown
86
  model_name1 = gr.Dropdown(
87
  label="Choose Model",
@@ -93,30 +91,25 @@ with gr.Blocks(css=css) as myface:
93
  with gr.Row():
94
  see_prompts = gr.Button("Generate Prompts")
95
  run = gr.Button("Generate Images", variant="primary")
96
- with gr.Tab("Main"):
97
- with gr.Row():
98
- output1 = gr.Image(label=f"{current_model['name']}")
99
- output2 = gr.Image(label=f"{current_model['name']}")
100
- output3 = gr.Image(label=f"{current_model['name']}")
101
- output4 = gr.Image(label=f"{current_model['name']}")
102
- with gr.Row():
103
- magic1 = gr.Textbox(lines=4)
104
- magic2 = gr.Textbox(lines=4)
105
- magic3 = gr.Textbox(lines=4)
106
- magic4 = gr.Textbox(lines=4)
107
-
108
- with gr.Row():
109
- output5 = gr.Image(label=f"{current_model['name']}")
110
- output6 = gr.Image(label=f"{current_model['name']}")
111
- output7 = gr.Image(label=f"{current_model['name']}")
112
- output8 = gr.Image(label=f"{current_model['name']}")
113
- with gr.Row():
114
- magic5 = gr.Textbox(lines=4)
115
- magic6 = gr.Textbox(lines=4)
116
- magic7 = gr.Textbox(lines=4)
117
- magic8 = gr.Textbox(lines=4)
118
 
119
- model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2, output3, output4, output5, output6, output7, output8])
120
 
121
  run.click(send_it, inputs=[magic1, model_name1], outputs=[output1])
122
  run.click(send_it, inputs=[magic2, model_name1], outputs=[output2])
@@ -124,8 +117,6 @@ with gr.Blocks(css=css) as myface:
124
  run.click(send_it, inputs=[magic4, model_name1], outputs=[output4])
125
  run.click(send_it, inputs=[magic5, model_name1], outputs=[output5])
126
  run.click(send_it, inputs=[magic6, model_name1], outputs=[output6])
127
- run.click(send_it, inputs=[magic7, model_name1], outputs=[output7])
128
- run.click(send_it, inputs=[magic8, model_name1], outputs=[output8])
129
 
130
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic1])
131
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic2])
@@ -133,8 +124,6 @@ with gr.Blocks(css=css) as myface:
133
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic4])
134
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic5])
135
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic6])
136
- see_prompts.click(text_it, inputs=[input_text], outputs=[magic7])
137
- see_prompts.click(text_it, inputs=[input_text], outputs=[magic8])
138
 
139
  myface.queue(concurrency_count=200)
140
- myface.launch(inline=True, show_api=False, max_threads=400)
 
48
 
49
  current_model = models[0]
50
 
51
+ text_gen = gr.Interface.load("spaces/daspartho/prompt-extend")
52
 
53
  models2 = []
54
  for model in models:
 
64
  def set_model(current_model_index):
65
  global current_model
66
  current_model = models[current_model_index]
67
+ return gr.update(value=f"{current_model['name']}")
68
 
69
 
70
  def send_it(inputs, model_choice):
 
72
  return proc(inputs)
73
 
74
 
75
+ with gr.Blocks() as myface:
 
 
76
  gr.HTML(
77
 
78
  )
79
 
80
  with gr.Row():
81
  with gr.Row():
82
+ input_text = gr.Textbox(label="Prompt idea", placeholder="", lines=1)
83
  # Model selection dropdown
84
  model_name1 = gr.Dropdown(
85
  label="Choose Model",
 
91
  with gr.Row():
92
  see_prompts = gr.Button("Generate Prompts")
93
  run = gr.Button("Generate Images", variant="primary")
94
+
95
+ with gr.Row():
96
+ output1 = gr.Image(label="")
97
+ output2 = gr.Image(label="")
98
+ output3 = gr.Image(label="")
99
+ with gr.Row():
100
+ magic1 = gr.Textbox(label="Generated Prompt", lines=2)
101
+ magic2 = gr.Textbox(label="Generated Prompt", lines=2)
102
+ magic3 = gr.Textbox(label="Generated Prompt", lines=2)
103
+ with gr.Row():
104
+ output4 = gr.Image(label="")
105
+ output5 = gr.Image(label="")
106
+ output6 = gr.Image(label="")
107
+ with gr.Row():
108
+ magic4 = gr.Textbox(label="Generated Prompt", lines=2)
109
+ magic5 = gr.Textbox(label="Generated Prompt", lines=2)
110
+ magic6 = gr.Textbox(label="Generated Prompt", lines=2)
 
 
 
 
 
111
 
112
+ model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2, output3, output4, output5, output6])
113
 
114
  run.click(send_it, inputs=[magic1, model_name1], outputs=[output1])
115
  run.click(send_it, inputs=[magic2, model_name1], outputs=[output2])
 
117
  run.click(send_it, inputs=[magic4, model_name1], outputs=[output4])
118
  run.click(send_it, inputs=[magic5, model_name1], outputs=[output5])
119
  run.click(send_it, inputs=[magic6, model_name1], outputs=[output6])
 
 
120
 
121
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic1])
122
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic2])
 
124
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic4])
125
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic5])
126
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic6])
 
 
127
 
128
  myface.queue(concurrency_count=200)
129
+ myface.launch(inline=True, show_api=False, max_threads=400)