heyfazlur commited on
Commit
87dfa03
·
verified ·
1 Parent(s): 901a3ce

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import json
3
+
4
+ # Load the JSON workflow
5
+ with open("/mnt/data/1workflo", "r") as file:
6
+ workflow = json.load(file)
7
+
8
+ def generate_linkedin_headshot(image, prompt):
9
+ # Here you would integrate your logic to process the image and prompt
10
+ # 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_image
17
+
18
+ # Define the Gradio interface
19
+ with 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 app
34
+ demo.launch()