AlGe commited on
Commit
3dac59f
·
verified ·
1 Parent(s): cd72307

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,22 +1,24 @@
1
  import gradio as gr
2
- from gradio_client import Client
 
 
3
 
4
  # Initialize the client
5
  client = Client("radames/Enhance-This-HiDiffusion-SDXL")
6
 
7
- def enhance_image(image, prompt):
8
  # Use the client to predict the result
9
- result = client.predict(image, prompt, api_name="/predict")
10
  return result
11
 
12
  # Create the Gradio interface
13
  iface = gr.Interface(
14
  fn=enhance_image,
15
  inputs=[
16
- gr.Image(type="pil", label="Input Image"),
17
- gr.Textbox(lines=2, placeholder="Enter prompt here", label="Prompt")
18
  ],
19
- outputs=gr.Image(type="pil", label="Enhanced Image"),
20
  title="Image Enhancement with Text Prompt",
21
  description="Upload an image and provide a text prompt to enhance the image using HiDiffusion SDXL."
22
  )
 
1
  import gradio as gr
2
+ from gradio_client import Client, file
3
+ import tempfile
4
+ import os
5
 
6
  # Initialize the client
7
  client = Client("radames/Enhance-This-HiDiffusion-SDXL")
8
 
9
+ def enhance_image(image_path, prompt):
10
  # Use the client to predict the result
11
+ result = client.predict(image_path, prompt, api_name="/predict")
12
  return result
13
 
14
  # Create the Gradio interface
15
  iface = gr.Interface(
16
  fn=enhance_image,
17
  inputs=[
18
+ gr.inputs.Image(type="pil", label="Input Image", preprocess=file.preprocess_image, preprocess_kwargs={"image_mode": "RGB"}),
19
+ gr.inputs.Textbox(lines=2, placeholder="Enter prompt here", label="Prompt")
20
  ],
21
+ outputs=gr.outputs.Image(type="pil", label="Enhanced Image"),
22
  title="Image Enhancement with Text Prompt",
23
  description="Upload an image and provide a text prompt to enhance the image using HiDiffusion SDXL."
24
  )