Spaces:
Runtime error
Runtime error
File size: 1,802 Bytes
73a0ac5 69472c5 73a0ac5 e99ed63 3aa2c0c ce6f1e4 73a0ac5 e99ed63 69472c5 73a0ac5 94ef02a e99ed63 94ef02a e99ed63 94ef02a e99ed63 94ef02a e99ed63 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
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 banner
ad_code = """
<div style="text-align: center;">
<a href=""><img alt="banner" src="https://landings-cdn.adsterratech.com/referralBanners/gif/468x120_adsterra_reff.gif" /></a>
</div>
"""
# Gradio interface
iface = gr.Blocks()
with iface:
gr.Markdown("""
# AI Image with Any Face
Please donate something so I can get a GPU server. As low as $1 also accepted<br>
Generate free AI images with your face or any face.<br>
Contact me to bypass NSFW for more creativity and freedom😉<br>
<b>Donate something so I can increase the GPU power/queue</b><br>
[Click here to Donate](https://nowpayments.io/donation/aheed)<br>
Contact me for bulk processing and more AI software at +92-332-4399819<br>
Please support me in making better AI tools as I am a solo developer<br>
[Click here to Donate](https://nowpayments.io/donation/aheed)<br>
<b>Do not duplicate this space without permission.</b>
""")
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()
|