File size: 1,257 Bytes
87dfa03
 
 
 
56502ee
87dfa03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gradio as gr
import json

# Load the JSON workflow
with open("/home/user/app/1workflo.json", "r") as file:
    workflow = json.load(file)

def generate_linkedin_headshot(image, prompt):
    # Here you would integrate your logic to process the image and prompt
    # using the ComfyUI workflow. This is a placeholder for demonstration.
    
    # Assuming you have a function `apply_comfyui_workflow` that takes an image,
    # prompt, and the workflow JSON to produce the output.
    
    processed_image = apply_comfyui_workflow(image, prompt, workflow)
    return processed_image

# Define the Gradio interface
with gr.Blocks() as demo:
    gr.Markdown("# LinkedIn Headshot Generator")
    
    with gr.Row():
        with gr.Column():
            image_input = gr.Image(label="Upload your headshot", type="pil")
            prompt_input = gr.Textbox(label="Describe the professional look you want (e.g., 'business casual, smiling')")
        
        with gr.Column():
            output_image = gr.Image(label="Generated LinkedIn Headshot")
    
    generate_button = gr.Button("Generate Headshot")
    generate_button.click(fn=generate_linkedin_headshot, inputs=[image_input, prompt_input], outputs=output_image)

# Launch the app
demo.launch()