AlGe commited on
Commit
a0132bf
·
verified ·
1 Parent(s): 51524a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -1,21 +1,25 @@
1
- # Let's re-evaluate the implementation using the guide for making predictions with the Gradio client
2
  import gradio as gr
3
- from gradio.client import Client
4
 
5
- # Define the function to call the existing Gradio space API using the Gradio client
6
- def enhance_image(input_image):
7
- client = Client("radames/Enhance-This-HiDiffusion-SDXL")
8
- result = client.predict(input_image, api_name="/predict")
 
 
9
  return result
10
 
11
  # Create the Gradio interface
12
- interface = gr.Interface(
13
  fn=enhance_image,
14
- inputs=gr.Image(type="pil", label="Input Image"),
 
 
 
15
  outputs=gr.Image(type="pil", label="Enhanced Image"),
16
- title="Enhance This HiDiffusion SDXL",
17
- description="Upload an image to enhance it using HiDiffusion SDXL."
18
  )
19
 
20
- # Launch the app
21
- interface.launch()
 
 
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
  )
23
 
24
+ # Launch the interface
25
+ iface.launch()