Spaces:
Runtime error
Runtime error
File size: 7,648 Bytes
f762231 3d0272c f762231 a935ecc 6044c13 db27c64 6044c13 f762231 933eaf9 f30af9d 933eaf9 f762231 933eaf9 f30af9d 933eaf9 f30af9d 933eaf9 f30af9d 933eaf9 f762231 933eaf9 3d0272c f30af9d 3d0272c f30af9d f762231 933eaf9 f762231 |
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
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"""
<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/keys' 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":
# 是否显示token输入框
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/keys' 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":
# 是否显示token输入框
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/keys' 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":
# 是否显示token输入框
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/keys' 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":
# 是否显示token输入框
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/keys' 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":
# 是否显示token输入框
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/keys' 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":
# 是否显示token输入框
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/keys' 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
Param4Label = "How much to expand width (0 - 2)"
Param4Visible = True
Param5Label = "How much to expand height (0 - 2)"
Param5Visible = True
else:
# 是否显示token输入框
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/keys' 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/keys) to continue..."
else:
# 当试用次数耗尽,显示的信息
no_more_attempts = "You've exhausted all trial attempts."
|