Spaces:
Runtime error
Runtime error
File size: 909 Bytes
ef7e565 3dac59f 2eaf831 a0132bf 3dac59f a0132bf 3dac59f 02ef30b 2eaf831 a0132bf 2eaf831 a0132bf 3dac59f a0132bf 3dac59f a0132bf 2eaf831 a0132bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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()
|