|
|
|
|
|
import os |
|
import sys |
|
import cv2 |
|
import json |
|
import random |
|
import time |
|
import pickle |
|
import requests |
|
import func_timeout |
|
import numpy as np |
|
import gradio as gr |
|
from PIL import Image |
|
from collections import OrderedDict |
|
|
|
|
|
taskType = "3" |
|
try: |
|
taskType = str(os.environ['taskType']) |
|
except Exception as e: |
|
print(e) |
|
|
|
|
|
CapVisible = True |
|
Param4Label = "" |
|
Param4Visible = False |
|
Param5Label = "" |
|
Param5Visible = False |
|
TempInter = True |
|
|
|
if taskType=="3": |
|
|
|
is_show_token = True |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Poster Background Generation</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "Choose a template" |
|
TempVisible = True |
|
UserLabel = "product photo" |
|
CaptionLabel = "English caption text (optional)" |
|
|
|
elif taskType=="4": |
|
|
|
TempInter = False |
|
is_show_token = True |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: AI Model Replace</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "Choose a Model" |
|
TempVisible = True |
|
UserLabel = "upload photo" |
|
CaptionLabel = "English caption text (optional)" |
|
|
|
elif taskType=="6": |
|
|
|
is_show_token = True |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Image Style Filter</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "Choose a Style" |
|
TempVisible = True |
|
UserLabel = "upload photo" |
|
CaptionLabel = "English caption text (optional)" |
|
|
|
elif taskType=="5": |
|
|
|
is_show_token = True |
|
TempInter = False |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Poster(human) Background Swap</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "background info" |
|
TempVisible = True |
|
UserLabel = "upload photo" |
|
CaptionLabel = "English caption text (optional)" |
|
|
|
elif taskType=="1": |
|
|
|
is_show_token = True |
|
TempInter = False |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Object Segment</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "guide" |
|
TempVisible = True |
|
UserLabel = "upload photo" |
|
CaptionLabel = "English caption text (optional)" |
|
CapVisible = False |
|
|
|
elif taskType=="2": |
|
|
|
is_show_token = True |
|
TempInter = False |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Object Remove</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "guide" |
|
TempVisible = True |
|
UserLabel = "upload and paint photo" |
|
CaptionLabel = "English caption text (optional)" |
|
CapVisible = False |
|
|
|
elif taskType=="7": |
|
|
|
is_show_token = True |
|
TempInter = False |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Image Outpaint</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/extension' target='_blank'><b>HeyBeauty</b></a> for Faster and Free AI App! 🤗 .<br> |
|
|
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "guide" |
|
TempVisible = True |
|
UserLabel = "upload and paint photo" |
|
CaptionLabel = "English caption text (required)" |
|
CapVisible = True |
|
|
|
elif taskType=="9": |
|
|
|
is_show_token = True |
|
TempInter = False |
|
|
|
title = r""" |
|
<h1 align="center">Red Panda Image Generator by Recraft</h1> |
|
""" |
|
|
|
description = r""" |
|
Go to <a href='https://heybeauty.ai/red-panda-recraft' target='_blank'><b>Recraft</b></a> for Faster and Free Generation! 🤗 .<br> |
|
Ever since its release, Recraft V3 has received accolades for its outstanding performance in AI image generation. With the highest ELO score of 1172 on the Artificial Analysis leaderboard and over 100,000 votes, it stands out as the superior choice for creating next-level visuals. |
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. After exhausted all trial attempts, you can <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
TempLabel = "guide" |
|
TempVisible = True |
|
UserLabel = "upload and paint photo" |
|
CaptionLabel = "caption text (required, any language)" |
|
CapVisible = True |
|
|
|
else: |
|
|
|
is_show_token = False |
|
|
|
title = r""" |
|
<h1 align="center">Selfit AI App: Poster(product) background generation</h1> |
|
""" |
|
|
|
description = r""" |
|
<a href='https://heybeauty.ai/extension' target='_blank'><b> Go to HeyBeauty for Faster and Free AI App! 🤗 </b></a>.<br> |
|
|
|
<b>Official 🤗 Gradio demo</b> for <a href='https://github.com/selfitcamera/Outfit-Anyone-in-the-Wild' target='_blank'><b>Product poster background generation</b></a>.<br> |
|
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. |
|
2. <a href='https://heybeauty.ai/home/apikeys' target='_blank'><b>You can find your api key here</b></a> .<br> |
|
3. Share app with your friends and enjoy! 😊.<br> |
|
""" |
|
|
|
if is_show_token: |
|
|
|
no_more_attempts = "You've exhausted all trial attempts. [Enter Your API Key](https://heybeauty.ai/home/apikeys) to continue..." |
|
else: |
|
|
|
no_more_attempts = "You've exhausted all trial attempts." |
|
|
|
|
|
|