Spaces:
Runtime error
Runtime error
add example images
Browse files- app.py +7 -2
- examples/{input_1.jpg β images/input_1.jpg} +0 -0
- examples/{input_2.jpg β images/input_2.jpg} +0 -0
- examples/{input_3.jpg β images/input_3.jpg} +0 -0
- examples/{input_4.jpg β images/input_4.jpg} +0 -0
- examples/{input_5.jpg β images/input_5.jpg} +0 -0
- examples/prompts.json +7 -0
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os
|
2 |
|
3 |
import numpy as np
|
@@ -33,8 +34,12 @@ def read_content(file_path: str) -> str:
|
|
33 |
return content
|
34 |
|
35 |
|
36 |
-
image_dir = 'examples'
|
37 |
image_list = [os.path.join(image_dir, file) for file in os.listdir(image_dir)]
|
|
|
|
|
|
|
|
|
38 |
|
39 |
block = gr.Blocks().queue()
|
40 |
with block:
|
@@ -45,7 +50,7 @@ with block:
|
|
45 |
input_image = gr.Image(type="numpy")
|
46 |
prompt = gr.Textbox(label="Prompt")
|
47 |
run_button = gr.Button(value="Run")
|
48 |
-
gr.Examples(
|
49 |
|
50 |
gr.HTML(
|
51 |
"""
|
|
|
1 |
+
import json
|
2 |
import os
|
3 |
|
4 |
import numpy as np
|
|
|
34 |
return content
|
35 |
|
36 |
|
37 |
+
image_dir = 'examples/images'
|
38 |
image_list = [os.path.join(image_dir, file) for file in os.listdir(image_dir)]
|
39 |
+
with open('examples/prompts.json', 'r') as f:
|
40 |
+
prompts_list = json.load(f).values()
|
41 |
+
examples = [[image, prompt] for image, prompt in zip(image_list, prompts_list)]
|
42 |
+
|
43 |
|
44 |
block = gr.Blocks().queue()
|
45 |
with block:
|
|
|
50 |
input_image = gr.Image(type="numpy")
|
51 |
prompt = gr.Textbox(label="Prompt")
|
52 |
run_button = gr.Button(value="Run")
|
53 |
+
gr.Examples(examples=examples, inputs=[input_image, prompt], label="Examples - Input Images", examples_per_page=12)
|
54 |
|
55 |
gr.HTML(
|
56 |
"""
|
examples/{input_1.jpg β images/input_1.jpg}
RENAMED
File without changes
|
examples/{input_2.jpg β images/input_2.jpg}
RENAMED
File without changes
|
examples/{input_3.jpg β images/input_3.jpg}
RENAMED
File without changes
|
examples/{input_4.jpg β images/input_4.jpg}
RENAMED
File without changes
|
examples/{input_5.jpg β images/input_5.jpg}
RENAMED
File without changes
|
examples/prompts.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"input_1.jpg": "a woman wearing a white top and jeans with a high waist and a high rise heming hem is standing in front of a white background, Christian Hilfgott Brand, waist up, a photocopy, neoclassicism",
|
3 |
+
"input_2.jpg": "a woman wearing a black and white sweater and black denim skirt with lace detailing on the sleeves and hem, Annabel Kidston, fine foliage lace, a stipple, rococo",
|
4 |
+
"input_3.jpg": "a woman in a pink dress and black jacket walking down a runway with a black jacket on her shoulders, Constance-Anne Parker, fashion, a flemish Baroque, barbizon school",
|
5 |
+
"input_4.jpg": "a man in a tuxedo and bow tie at an oscars event with a red carpet and white wall, Americo Makk, full length, a marble sculpture, tachisme",
|
6 |
+
"input_5.jpg": "a woman in a dress standing next to a chair and a chair with a chair in front of it, Christian Hilfgott Brand, hourglass slim figure, a digital rendering, american barbizon school"
|
7 |
+
}
|