heyfazlur's picture
Update app.py
56502ee verified
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()