Spaces:
Sleeping
Sleeping
updated app.py
#1
by
abjayakar
- opened
app.py
CHANGED
@@ -8,6 +8,9 @@ pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
|
|
8 |
# Define the starter and end prompts
|
9 |
starter_prompt = "Create a detailed sketch of a person based on the following description: "
|
10 |
end_prompt = " The sketch should have a monochromatic style, resembling a police mugshot, with clear outlines and shading to emphasize facial features. The background should be plain to focus on the subject."
|
|
|
|
|
|
|
11 |
|
12 |
# Function to generate the sketch
|
13 |
def generate_sketch(main_prompt):
|
@@ -24,7 +27,14 @@ def generate_sketch(main_prompt):
|
|
24 |
with gr.Blocks() as demo:
|
25 |
gr.Markdown("# InkScribe")
|
26 |
main_prompt_input = gr.Textbox(label="Enter Description", placeholder="e.g., A young woman with curly black hair and green eyes, looking directly at the viewer.")
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
generate_button = gr.Button("Generate Sketch")
|
|
|
28 |
output_image = gr.Image(label="Generated Sketch", width= 512, height= 512)
|
29 |
|
30 |
# Set up event handling
|
|
|
8 |
# Define the starter and end prompts
|
9 |
starter_prompt = "Create a detailed sketch of a person based on the following description: "
|
10 |
end_prompt = " The sketch should have a monochromatic style, resembling a police mugshot, with clear outlines and shading to emphasize facial features. The background should be plain to focus on the subject."
|
11 |
+
examples = [
|
12 |
+
["A young woman with curly black hair and green eyes, looking directly at the viewer."]]
|
13 |
+
|
14 |
|
15 |
# Function to generate the sketch
|
16 |
def generate_sketch(main_prompt):
|
|
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.Markdown("# InkScribe")
|
29 |
main_prompt_input = gr.Textbox(label="Enter Description", placeholder="e.g., A young woman with curly black hair and green eyes, looking directly at the viewer.")
|
30 |
+
gr.Examples(
|
31 |
+
examples=examples,
|
32 |
+
inputs=input_text,
|
33 |
+
outputs=None, # Outputs are handled by the button click
|
34 |
+
label="Select an Example"
|
35 |
+
)
|
36 |
generate_button = gr.Button("Generate Sketch")
|
37 |
+
clear_button = gr.Button("Clear Prompt")
|
38 |
output_image = gr.Image(label="Generated Sketch", width= 512, height= 512)
|
39 |
|
40 |
# Set up event handling
|