Spaces:
Runtime error
Runtime error
p@localhost
commited on
Commit
β’
85bac91
1
Parent(s):
ee589a1
updates code
Browse files
README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.35.2
|
8 |
app_file: app.py
|
9 |
-
pinned:
|
10 |
license: unknown
|
11 |
---
|
12 |
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: lunarnaut - generaciΓ³n de imΓ‘genes
|
3 |
+
emoji: π
|
4 |
+
colorFrom: black
|
5 |
+
colorTo: black
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.35.2
|
8 |
app_file: app.py
|
9 |
+
pinned: true
|
10 |
license: unknown
|
11 |
---
|
12 |
|
|
app.py
CHANGED
@@ -6,46 +6,34 @@ def generate(prompt, n_prompt, modelName):
|
|
6 |
def create_demo():
|
7 |
with gr.Blocks() as demo:
|
8 |
with gr.Column():
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
)
|
29 |
-
n_prompt.submit(
|
30 |
-
fn=generate,
|
31 |
-
inputs=inputs,
|
32 |
-
outputs=result
|
33 |
-
)
|
34 |
-
|
35 |
-
run_button.click(
|
36 |
-
fn=generate,
|
37 |
-
inputs=inputs,
|
38 |
-
outputs=result
|
39 |
-
)
|
40 |
return demo
|
41 |
|
42 |
|
43 |
if __name__ == '__main__':
|
44 |
from model import Model
|
45 |
models = {
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
demo = create_demo()
|
51 |
demo.queue().launch()
|
|
|
6 |
def create_demo():
|
7 |
with gr.Blocks() as demo:
|
8 |
with gr.Column():
|
9 |
+
model_name = gr.Dropdown(choices = list(models.keys()), label = 'Modelo', value=list(models.keys())[0])
|
10 |
+
prompt = gr.Textbox(label='Prompt', value='A crescent moon')
|
11 |
+
negative_prompt = gr.Textbox( label='Negative Prompt', value='bad quality, low resolution')
|
12 |
+
generate_button = gr.Button('Generar')
|
13 |
+
|
14 |
+
gr.Markdown('''
|
15 |
+
#lunarnaut - intro a stable diffusion
|
16 |
+
---
|
17 |
+
1. Selecciona un Modelo
|
18 |
+
2. Agrega un prompt y prompt negativo
|
19 |
+
3. Haz clic en 'Generar'
|
20 |
+
''')
|
21 |
+
result = gr.Gallery(label='Resultado', show_label=False, elem_id='gallery').style(columns=1, rows=1, preview=True)
|
22 |
+
|
23 |
+
inputs = [ prompt, negative_prompt, model_name ]
|
24 |
+
|
25 |
+
prompt.submit(fn=generate, inputs=inputs, outputs=result)
|
26 |
+
negative_prompt.submit(fn=generate, inputs=inputs, outputs=result)
|
27 |
+
generate_button.click(fn=generate, inputs=inputs, outputs=result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
return demo
|
29 |
|
30 |
|
31 |
if __name__ == '__main__':
|
32 |
from model import Model
|
33 |
models = {
|
34 |
+
'Stable Diffusion v1.5': Model('runwayml/stable-diffusion-v1-5'),
|
35 |
+
'Anything v3.0': Model('Linaqruf/anything-v3.0'),
|
36 |
+
'Realistic Vision v2.0': Model('SG161222/Realistic_Vision_V2.0'),
|
37 |
+
}
|
38 |
demo = create_demo()
|
39 |
demo.queue().launch()
|