Brian Watson commited on
Commit
a9d8c5f
1 Parent(s): b51f9e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -46
app.py CHANGED
@@ -4,14 +4,14 @@ import sys
4
  from pathlib import Path
5
 
6
  models = [
7
- {"name": "Dreamlike Anime", "url": "dreamlike-art/dreamlike-anime-1.0"},
8
  {"name": "Dreamlike Diffusion", "url": "dreamlike-art/dreamlike-diffusion-1.0"},
 
9
  {"name": "Dreamlike Photoreal", "url": "dreamlike-art/dreamlike-photoreal-2.0"},
10
  ]
11
 
12
  current_model = models[0]
13
 
14
- text_gen = gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link")
15
 
16
  models2 = []
17
  for model in models:
@@ -27,7 +27,7 @@ def text_it(inputs, text_gen=text_gen):
27
  def set_model(current_model_index):
28
  global current_model
29
  current_model = models[current_model_index]
30
- return gr.update(label=f"{current_model['name']}")
31
 
32
 
33
  def send_it(inputs, model_choice):
@@ -35,27 +35,9 @@ def send_it(inputs, model_choice):
35
  return proc(inputs)
36
 
37
 
38
- css = """"""
39
-
40
- with gr.Blocks(css=css) as myface:
41
  gr.HTML(
42
- """<!DOCTYPE html>
43
- <html lang="en">
44
- <head>
45
- <meta charset="utf-8" />
46
- <meta name="twitter:card" content="player"/>
47
- <meta name="twitter:site" content=""/>
48
- <meta name="twitter:player" content="https://omnibus-maximum-multiplier-places.hf.space"/>
49
- <meta name="twitter:player:stream" content="https://omnibus-maximum-multiplier-places.hf.space"/>
50
- <meta name="twitter:player:width" content="100%"/>
51
- <meta name="twitter:player:height" content="600"/>
52
- <meta property="og:title" content="Embedded Live Viewer"/>
53
- <meta property="og:description" content="Tweet Genie - A Huggingface Space"/>
54
- <meta property="og:image" content="https://cdn.glitch.global/80dbe92e-ce75-44af-84d5-74a2e21e9e55/omnicard.png?v=1676772531627"/>
55
- <!--<meta http-equiv="refresh" content="0; url=https://huggingface.co/spaces/corbt/tweet-genie">-->
56
- </head>
57
- </html>
58
- """
59
  )
60
 
61
  with gr.Row():
@@ -72,28 +54,31 @@ with gr.Blocks(css=css) as myface:
72
  with gr.Row():
73
  see_prompts = gr.Button("Generate Prompts")
74
  run = gr.Button("Generate Images", variant="primary")
75
- with gr.Tab("Main"):
76
- with gr.Row():
77
- output1 = gr.Image(label=f"{current_model['name']}")
78
- output2 = gr.Image(label=f"{current_model['name']}")
79
- output3 = gr.Image(label=f"{current_model['name']}")
80
- output4 = gr.Image(label=f"{current_model['name']}")
81
- with gr.Row():
82
- magic1 = gr.Textbox(lines=4)
83
- magic2 = gr.Textbox(lines=4)
84
- magic3 = gr.Textbox(lines=4)
85
- magic4 = gr.Textbox(lines=4)
86
-
87
- with gr.Row():
88
- output5 = gr.Image(label=f"{current_model['name']}")
89
- output6 = gr.Image(label=f"{current_model['name']}")
90
- output7 = gr.Image(label=f"{current_model['name']}")
91
- output8 = gr.Image(label=f"{current_model['name']}")
92
- with gr.Row():
93
- magic5 = gr.Textbox(lines=4)
94
- magic6 = gr.Textbox(lines=4)
95
- magic7 = gr.Textbox(lines=4)
96
- magic8 = gr.Textbox(lines=4)
 
 
 
97
 
98
  model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2, output3, output4, output5, output6, output7, output8])
99
 
@@ -116,4 +101,4 @@ with gr.Blocks(css=css) as myface:
116
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic8])
117
 
118
  myface.queue(concurrency_count=200)
119
- myface.launch(inline=True, show_api=False, max_threads=400)
 
4
  from pathlib import Path
5
 
6
  models = [
 
7
  {"name": "Dreamlike Diffusion", "url": "dreamlike-art/dreamlike-diffusion-1.0"},
8
+ {"name": "Dreamlike Anime", "url": "dreamlike-art/dreamlike-anime-1.0"},
9
  {"name": "Dreamlike Photoreal", "url": "dreamlike-art/dreamlike-photoreal-2.0"},
10
  ]
11
 
12
  current_model = models[0]
13
 
14
+ text_gen = gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link")
15
 
16
  models2 = []
17
  for model in models:
 
27
  def set_model(current_model_index):
28
  global current_model
29
  current_model = models[current_model_index]
30
+ return gr.update(value=f"{current_model['name']}")
31
 
32
 
33
  def send_it(inputs, model_choice):
 
35
  return proc(inputs)
36
 
37
 
38
+ with gr.Blocks() as myface:
 
 
39
  gr.HTML(
40
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  )
42
 
43
  with gr.Row():
 
54
  with gr.Row():
55
  see_prompts = gr.Button("Generate Prompts")
56
  run = gr.Button("Generate Images", variant="primary")
57
+
58
+ with gr.Row():
59
+ output1 = gr.Image(label="")
60
+ output2 = gr.Image(label="")
61
+ with gr.Row():
62
+ magic1 = gr.Textbox(lines=2)
63
+ magic2 = gr.Textbox(lines=2)
64
+ with gr.Row():
65
+ output3 = gr.Image(label="")
66
+ output4 = gr.Image(label="")
67
+ with gr.Row():
68
+ magic3 = gr.Textbox(lines=2)
69
+ magic4 = gr.Textbox(lines=2)
70
+ with gr.Row():
71
+ output5 = gr.Image(label="")
72
+ output6 = gr.Image(label="")
73
+ with gr.Row():
74
+ magic5 = gr.Textbox(lines=2)
75
+ magic6 = gr.Textbox(lines=2)
76
+ with gr.Row():
77
+ output7 = gr.Image(label="")
78
+ output8 = gr.Image(label="")
79
+ with gr.Row():
80
+ magic7 = gr.Textbox(lines=2)
81
+ magic8 = gr.Textbox(lines=2)
82
 
83
  model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2, output3, output4, output5, output6, output7, output8])
84
 
 
101
  see_prompts.click(text_it, inputs=[input_text], outputs=[magic8])
102
 
103
  myface.queue(concurrency_count=200)
104
+ myface.launch(inline=True, show_api=False, max_threads=400)