import gradio as gr
from gradio_client import Client
# Clients for image generation and swapping
image_generation_client = Client("AP123/SDXL-Lightning")
image_swapping_client = Client("aheedsajid/test")
# Function to generate and swap images
def generate_and_swap_image(prompt, source_image):
generated_image = image_generation_client.predict(prompt, "4-Step", api_name="/generate_image")
swapped_image = image_swapping_client.predict(source_image, generated_image, True, api_name="/predict")
return swapped_image
# HTML code for the ad (replace with your actual ad code snippet)
ad_code = """
"""
# Gradio interface
iface = gr.Interface(
fn=generate_and_swap_image,
inputs=[
gr.Textbox(label="Enter your prompt (English)"),
gr.Image(label="Source Image", type="filepath"),
],
outputs=gr.Image(label="Swapped Image"),
title="AI Image with Any Face",
description="""
Please donate something so I can get a GPU server. As low as $1 also accepted
Generate free AI images with your face or any face.
Contact me to bypass NSFW for more creativity and freedom😉
Donate something so I can increase the GPU power/queue
[Click here to Donate](https://nowpayments.io/donation/aheed)
Contact me for bulk processing and more AI software at +92-332-4399819
Please support me in making better AI tools as I am a solo developer
[Click here to Donate](https://nowpayments.io/donation/aheed)
Do not duplicate this space without permission.
"""
)
# Adding the ad section
iface = gr.Blocks()
with iface:
gr.Markdown("# AI Image with Any Face")
gr.Markdown("""
Please donate something so I can get a GPU server. As low as $1 also accepted
Generate free AI images with your face or any face.
Contact me to bypass NSFW for more creativity and freedom😉
Donate something so I can increase the GPU power/queue
[Click here to Donate](https://nowpayments.io/donation/aheed)
Contact me for bulk processing and more AI software at +92-332-4399819
Please support me in making better AI tools as I am a solo developer
[Click here to Donate](https://nowpayments.io/donation/aheed)
Do not duplicate this space without permission.
""")
gr.HTML(ad_code)
gr.Interface(
fn=generate_and_swap_image,
inputs=[
gr.Textbox(label="Enter your prompt (English)"),
gr.Image(label="Source Image", type="filepath"),
],
outputs=gr.Image(label="Swapped Image")
)
iface.launch()