heyfazlur/LinkedINPhotoGenerator
7
1import gradio as gr2import json3 4# Load the JSON workflow5with open("/home/user/app/1workflo.json", "r") as file:6 workflow = json.load(file)7 8def generate_linkedin_headshot(image, prompt):9 # Here you would integrate your logic to process the image and prompt10 # using the ComfyUI workflow. This is a placeholder for demonstration.11 12 # Assuming you have a function `apply_comfyui_workflow` that takes an image,13 # prompt, and the workflow JSON to produce the output.14 15 processed_image = apply_comfyui_workflow(image, prompt, workflow)16 return processed_image17 18# Define the Gradio interface19with gr.Blocks() as demo:20 gr.Markdown("# LinkedIn Headshot Generator")21 22 with gr.Row():23 with gr.Column():24 image_input = gr.Image(label="Upload your headshot", type="pil")25 prompt_input = gr.Textbox(label="Describe the professional look you want (e.g., 'business casual, smiling')")26 27 with gr.Column():28 output_image = gr.Image(label="Generated LinkedIn Headshot")29 30 generate_button = gr.Button("Generate Headshot")31 generate_button.click(fn=generate_linkedin_headshot, inputs=[image_input, prompt_input], outputs=output_image)32 33# Launch the app34demo.launch()35 