Spaces:
Runtime error
Runtime error
tombetthauser
commited on
Commit
Β·
6b22177
1
Parent(s):
aa33c7d
Add beta tab
Browse files
app.py
CHANGED
@@ -247,6 +247,9 @@ def simple_image_prompt(prompt, dropdown):
|
|
247 |
)
|
248 |
|
249 |
|
|
|
|
|
|
|
250 |
with gr.Blocks(css=".gradio-container {max-width: 650px}") as new_welcome:
|
251 |
gr.Markdown('''
|
252 |
# π§βπ Astronaut Horse Concept Loader
|
@@ -272,6 +275,7 @@ with gr.Blocks(css=".gradio-container {max-width: 650px}") as new_welcome:
|
|
272 |
# -----------------------------------------------------------------------------------------------
|
273 |
|
274 |
|
|
|
275 |
def infer(text, dropdown):
|
276 |
images_list = pipe(
|
277 |
[f"{text} in the style of <{dropdown}>"],
|
@@ -284,6 +288,9 @@ def infer(text, dropdown):
|
|
284 |
css = ""
|
285 |
examples = []
|
286 |
|
|
|
|
|
|
|
287 |
with gr.Blocks(css=css) as demo:
|
288 |
state = gr.Variable({
|
289 |
'selected': -1
|
@@ -321,8 +328,46 @@ with gr.Blocks(css=css) as demo:
|
|
321 |
inputs=inputs,
|
322 |
outputs=[infer_outputs, community_icon, loading_icon]
|
323 |
)
|
324 |
-
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
|
328 |
tabbed_interface = gr.TabbedInterface([new_welcome, dropdown_tab], ["Welcome!", "Advanced Prompting"])
|
|
|
247 |
)
|
248 |
|
249 |
|
250 |
+
|
251 |
+
# ~~~ WELCOME TAB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
252 |
+
|
253 |
with gr.Blocks(css=".gradio-container {max-width: 650px}") as new_welcome:
|
254 |
gr.Markdown('''
|
255 |
# π§βπ Astronaut Horse Concept Loader
|
|
|
275 |
# -----------------------------------------------------------------------------------------------
|
276 |
|
277 |
|
278 |
+
|
279 |
def infer(text, dropdown):
|
280 |
images_list = pipe(
|
281 |
[f"{text} in the style of <{dropdown}>"],
|
|
|
288 |
css = ""
|
289 |
examples = []
|
290 |
|
291 |
+
|
292 |
+
# ~~~ DEMO TAB? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
293 |
+
|
294 |
with gr.Blocks(css=css) as demo:
|
295 |
state = gr.Variable({
|
296 |
'selected': -1
|
|
|
328 |
inputs=inputs,
|
329 |
outputs=[infer_outputs, community_icon, loading_icon]
|
330 |
)
|
331 |
+
|
332 |
+
|
333 |
+
# -----------------------------------------------------------------------------------------------
|
334 |
+
|
335 |
+
# ~~~ BETA TAB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
336 |
+
|
337 |
+
# def infer(text, dropdown):
|
338 |
+
# images_list = pipe(
|
339 |
+
# [f"{text} in the style of <{dropdown}>"],
|
340 |
+
# num_inference_steps=30,
|
341 |
+
# guidance_scale=7.5
|
342 |
+
# )
|
343 |
+
# return images_list.images, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
344 |
+
|
345 |
+
|
346 |
+
# css = ""
|
347 |
+
# examples = []
|
348 |
+
|
349 |
+
with gr.Blocks() as new_welcome:
|
350 |
+
gr.Markdown('''
|
351 |
+
# π§βπ Beta Concept Loader
|
352 |
+
|
353 |
+
This tool allows you to test out newly trained beta concepts trained by artists. These are experimental and may be removed if they are problematic or uninteresting. If they end up being interesting or successful though they'll be renamed and moved into the primary prompting drop-down.
|
354 |
+
|
355 |
+
Artists can now freely train new models / concepts using the link below. This uses free access to Google's GPUs but will require a password / key that you can ask for on our discord. After a new concept / model is trained it will be automatically added to this tab after ~24 hours. Check it out!
|
356 |
+
<a href="https://colab.research.google.com/drive/1FhOpcEjHT7EN53Zv9MFLQTytZp11wjqg#scrollTo=hzUluHT-I42O">https://colab.research.google.com/astronaut-horse-training-tool</a>
|
357 |
+
''')
|
358 |
+
dropdown = gr.Dropdown([dropdown for dropdown in list(DROPDOWNS) if 'ahx-beta' in dropdown], label="choose style...")
|
359 |
+
|
360 |
+
# with gr.Row():
|
361 |
+
prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
|
362 |
+
|
363 |
+
go_button = gr.Button("generate image", elem_id="go-button")
|
364 |
+
output = gr.Image(elem_id="output-image")
|
365 |
+
output_text = gr.Text(elem_id="output-text")
|
366 |
+
go_button.click(fn=simple_image_prompt, inputs=[prompt, dropdown], outputs=[output, output_text])
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
# -----------------------------------------------------------------------------------------------
|
371 |
|
372 |
|
373 |
tabbed_interface = gr.TabbedInterface([new_welcome, dropdown_tab], ["Welcome!", "Advanced Prompting"])
|