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": # 是否显示token输入框 is_show_token = True # 标题 title = r"""

Selfit AI App: Poster Background Generation

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "Choose a template" TempVisible = True UserLabel = "product photo" CaptionLabel = "English caption text (optional)" elif taskType=="4": # 是否显示token输入框 TempInter = False is_show_token = True # 标题 title = r"""

Selfit AI App: AI Model Replace

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "Choose a Model" TempVisible = True UserLabel = "upload photo" CaptionLabel = "English caption text (optional)" elif taskType=="6": # 是否显示token输入框 is_show_token = True # 标题 title = r"""

Selfit AI App: Image Style Filter

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "Choose a Style" TempVisible = True UserLabel = "upload photo" CaptionLabel = "English caption text (optional)" elif taskType=="5": # 是否显示token输入框 is_show_token = True TempInter = False # 标题 title = r"""

Selfit AI App: Poster(human) Background Swap

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "background info" TempVisible = True UserLabel = "upload photo" CaptionLabel = "English caption text (optional)" elif taskType=="1": # 是否显示token输入框 is_show_token = True TempInter = False # 标题 title = r"""

Selfit AI App: Object Segment

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "guide" TempVisible = True UserLabel = "upload photo" CaptionLabel = "English caption text (optional)" CapVisible = False elif taskType=="2": # 是否显示token输入框 is_show_token = True TempInter = False # 标题 title = r"""

AI Object Removal

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free Object Removal! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "guide" TempVisible = True UserLabel = "upload and paint photo" CaptionLabel = "English caption text (optional)" CapVisible = False elif taskType=="7": # 是否显示token输入框 is_show_token = True TempInter = False # 标题 title = r"""

Selfit AI App: Image Outpaint

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "guide" TempVisible = True UserLabel = "upload and paint photo" CaptionLabel = "English caption text (required)" CapVisible = True elif taskType=="9": # 是否显示token输入框 is_show_token = True TempInter = False # 标题 title = r"""

Red Panda Image Generator by Recraft

""" # 标题下的描述 description = r""" Go to Recraft for Faster and Free Generation! 🤗 .
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 find your api key here .
3. Share app with your friends and enjoy! 😊.
""" # 组件信息 TempLabel = "guide" TempVisible = True UserLabel = "upload and paint photo" CaptionLabel = "caption text (required, any language)" CapVisible = True else: # 是否显示token输入框 is_show_token = False # 标题 title = r"""

Selfit AI App: Poster(product) background generation

""" # 标题下的描述 description = r""" Go to HeyBeauty for Faster and Free AI App! 🤗 .
Official 🤗 Gradio demo for Product poster background generation.
1. Please wait for a while after submitting the task, you will get the result within 30 seconds. 2. You can find your api key here .
3. Share app with your friends and enjoy! 😊.
""" 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."