AlGe's picture
Update app.py
3dac59f verified
raw
history blame
909 Bytes
import gradio as gr
from gradio_client import Client, file
import tempfile
import os
# Initialize the client
client = Client("radames/Enhance-This-HiDiffusion-SDXL")
def enhance_image(image_path, prompt):
# Use the client to predict the result
result = client.predict(image_path, prompt, api_name="/predict")
return result
# Create the Gradio interface
iface = gr.Interface(
fn=enhance_image,
inputs=[
gr.inputs.Image(type="pil", label="Input Image", preprocess=file.preprocess_image, preprocess_kwargs={"image_mode": "RGB"}),
gr.inputs.Textbox(lines=2, placeholder="Enter prompt here", label="Prompt")
],
outputs=gr.outputs.Image(type="pil", label="Enhanced Image"),
title="Image Enhancement with Text Prompt",
description="Upload an image and provide a text prompt to enhance the image using HiDiffusion SDXL."
)
# Launch the interface
iface.launch()