Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
Β·
4738528
1
Parent(s):
9a3fb3f
init
Browse files
app.py
CHANGED
|
@@ -8,15 +8,15 @@ from util import process_image_edit, process_local_image_edit, download_and_chec
|
|
| 8 |
from nfsw import NSFWDetector
|
| 9 |
|
| 10 |
# Configuration parameters
|
| 11 |
-
FREE_TRY_N =
|
| 12 |
-
SLOW_TRY_N =
|
| 13 |
-
SLOW2_TRY_N =
|
| 14 |
-
RATE_LIMIT_60 =
|
| 15 |
|
| 16 |
# Time window configuration (minutes)
|
| 17 |
-
PHASE_1_WINDOW = 5 #
|
| 18 |
-
PHASE_2_WINDOW =
|
| 19 |
-
PHASE_3_WINDOW =
|
| 20 |
MAX_IMAGES_PER_WINDOW = 2 # Max images per time window
|
| 21 |
|
| 22 |
IP_Dict = {}
|
|
@@ -50,15 +50,15 @@ def get_ip_phase(client_ip):
|
|
| 50 |
"""
|
| 51 |
count = get_ip_generation_count(client_ip)
|
| 52 |
|
| 53 |
-
if count < FREE_TRY_N:
|
| 54 |
return 'free'
|
| 55 |
-
elif count < SLOW_TRY_N:
|
| 56 |
-
return 'rate_limit_1' # NSFW blur +
|
| 57 |
-
elif count < SLOW2_TRY_N:
|
| 58 |
-
return 'rate_limit_2' # NSFW blur +
|
| 59 |
-
elif count < RATE_LIMIT_60:
|
| 60 |
-
return 'rate_limit_3' # NSFW blur +
|
| 61 |
-
else:
|
| 62 |
return 'blocked' # Generation blocked
|
| 63 |
|
| 64 |
def check_rate_limit_for_phase(client_ip, phase):
|
|
@@ -73,11 +73,11 @@ def check_rate_limit_for_phase(client_ip, phase):
|
|
| 73 |
|
| 74 |
# Determine time window
|
| 75 |
if phase == 'rate_limit_1':
|
| 76 |
-
window_minutes = PHASE_1_WINDOW
|
| 77 |
elif phase == 'rate_limit_2':
|
| 78 |
-
window_minutes = PHASE_2_WINDOW
|
| 79 |
else: # rate_limit_3
|
| 80 |
-
window_minutes = PHASE_3_WINDOW
|
| 81 |
|
| 82 |
current_time = time.time()
|
| 83 |
window_key = f"{client_ip}_{phase}"
|
|
@@ -231,7 +231,7 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 231 |
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
|
| 232 |
transition: all 0.3s ease;
|
| 233 |
border: none;
|
| 234 |
-
'
|
| 235 |
</div>
|
| 236 |
"""
|
| 237 |
return None, f"β You have reached Hugging Face's free generation limit. Please visit https://omnicreator.net/#generator for unlimited generation", gr.update(value=blocked_button_html, visible=True)
|
|
@@ -292,7 +292,19 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 292 |
status_message = message
|
| 293 |
# Add error handling to prevent progress update failure
|
| 294 |
if progress is not None:
|
| 295 |
-
progress
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
except Exception as e:
|
| 297 |
print(f"β οΈ Progress update failed: {e}")
|
| 298 |
|
|
@@ -404,7 +416,7 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 404 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 405 |
transition: all 0.3s ease;
|
| 406 |
border: none;
|
| 407 |
-
'
|
| 408 |
<a href='https://omnicreator.net/#generator' target='_blank' style='
|
| 409 |
display: inline-flex;
|
| 410 |
align-items: center;
|
|
@@ -421,7 +433,7 @@ def edit_image_interface(input_image, prompt, request: gr.Request, progress=gr.P
|
|
| 421 |
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 422 |
transition: all 0.3s ease;
|
| 423 |
border: none;
|
| 424 |
-
'
|
| 425 |
</div>
|
| 426 |
"""
|
| 427 |
|
|
@@ -498,7 +510,7 @@ def local_edit_interface(image_dict, prompt, request: gr.Request, progress=gr.Pr
|
|
| 498 |
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
|
| 499 |
transition: all 0.3s ease;
|
| 500 |
border: none;
|
| 501 |
-
'
|
| 502 |
</div>
|
| 503 |
"""
|
| 504 |
return None, f"β You have reached Hugging Face's free generation limit. Please visit https://omnicreator.net/#generator for unlimited generation", gr.update(value=blocked_button_html, visible=True)
|
|
@@ -559,7 +571,19 @@ def local_edit_interface(image_dict, prompt, request: gr.Request, progress=gr.Pr
|
|
| 559 |
status_message = message
|
| 560 |
# Add error handling to prevent progress update failure
|
| 561 |
if progress is not None:
|
| 562 |
-
progress
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
except Exception as e:
|
| 564 |
print(f"β οΈ Local edit progress update failed: {e}")
|
| 565 |
|
|
@@ -671,7 +695,7 @@ def local_edit_interface(image_dict, prompt, request: gr.Request, progress=gr.Pr
|
|
| 671 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 672 |
transition: all 0.3s ease;
|
| 673 |
border: none;
|
| 674 |
-
'
|
| 675 |
<a href='https://omnicreator.net/#generator' target='_blank' style='
|
| 676 |
display: inline-flex;
|
| 677 |
align-items: center;
|
|
@@ -688,7 +712,7 @@ def local_edit_interface(image_dict, prompt, request: gr.Request, progress=gr.Pr
|
|
| 688 |
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 689 |
transition: all 0.3s ease;
|
| 690 |
border: none;
|
| 691 |
-
'
|
| 692 |
</div>
|
| 693 |
"""
|
| 694 |
|
|
@@ -748,221 +772,142 @@ def create_app():
|
|
| 748 |
</div>
|
| 749 |
""", padding=False)
|
| 750 |
|
| 751 |
-
#
|
| 752 |
gr.HTML("""
|
| 753 |
-
<
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 757 |
</div>
|
| 758 |
""", padding=False)
|
| 759 |
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
with gr.
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
-
height=512,
|
| 770 |
-
elem_classes=["upload-area"]
|
| 771 |
-
)
|
| 772 |
-
|
| 773 |
-
gr.Markdown("### βοΈ Editing Instructions")
|
| 774 |
-
prompt_input = gr.Textbox(
|
| 775 |
-
label="Enter editing prompt",
|
| 776 |
-
placeholder="For example: change background to beach, add rainbow, remove background, etc...",
|
| 777 |
-
lines=3,
|
| 778 |
-
max_lines=5
|
| 779 |
-
)
|
| 780 |
-
|
| 781 |
-
edit_button = gr.Button(
|
| 782 |
-
"π Start Editing",
|
| 783 |
-
variant="primary",
|
| 784 |
-
size="lg"
|
| 785 |
-
)
|
| 786 |
-
|
| 787 |
-
with gr.Column(scale=1):
|
| 788 |
-
gr.Markdown("### π― Editing Result")
|
| 789 |
-
output_image = gr.Image(
|
| 790 |
-
label="Edited image",
|
| 791 |
-
height=320,
|
| 792 |
-
elem_classes=["result-area"]
|
| 793 |
-
)
|
| 794 |
-
|
| 795 |
-
# Add "Use as Input" button
|
| 796 |
-
use_as_input_btn = gr.Button(
|
| 797 |
-
"π Use as Input",
|
| 798 |
-
variant="secondary",
|
| 799 |
-
size="sm",
|
| 800 |
-
elem_classes=["use-as-input-btn"]
|
| 801 |
-
)
|
| 802 |
-
|
| 803 |
-
status_output = gr.Textbox(
|
| 804 |
-
label="Processing status",
|
| 805 |
-
lines=2,
|
| 806 |
-
max_lines=3,
|
| 807 |
-
interactive=False
|
| 808 |
-
)
|
| 809 |
-
|
| 810 |
-
# Action buttons that will show after task completion
|
| 811 |
-
action_buttons = gr.HTML(visible=False)
|
| 812 |
-
|
| 813 |
-
# Example area
|
| 814 |
-
gr.Markdown("### π‘ Prompt Examples")
|
| 815 |
-
with gr.Row():
|
| 816 |
-
example_prompts = [
|
| 817 |
-
"Set the background to a grand opera stage with red curtains",
|
| 818 |
-
"Change the outfit into a traditional Chinese hanfu with flowing sleeves",
|
| 819 |
-
"Give the character blue dragon-like eyes with glowing pupils",
|
| 820 |
-
"Change lighting to soft dreamy pastel glow",
|
| 821 |
-
"Change pose to sitting cross-legged on the ground"
|
| 822 |
-
]
|
| 823 |
-
|
| 824 |
-
for prompt in example_prompts:
|
| 825 |
-
gr.Button(
|
| 826 |
-
prompt,
|
| 827 |
-
size="sm"
|
| 828 |
-
).click(
|
| 829 |
-
lambda p=prompt: p,
|
| 830 |
-
outputs=prompt_input
|
| 831 |
-
)
|
| 832 |
-
|
| 833 |
-
# Bind button click events - simplified, remove state management
|
| 834 |
-
edit_button.click(
|
| 835 |
-
fn=edit_image_interface,
|
| 836 |
-
inputs=[input_image, prompt_input],
|
| 837 |
-
outputs=[output_image, status_output, action_buttons],
|
| 838 |
-
show_progress=True,
|
| 839 |
-
# Increase concurrency settings
|
| 840 |
-
concurrency_limit=10, # Limit concurrent requests
|
| 841 |
-
api_name="global_edit"
|
| 842 |
)
|
| 843 |
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
|
|
|
|
|
|
| 849 |
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
)
|
| 855 |
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
# type="pil",
|
| 864 |
-
# height=512,
|
| 865 |
-
# brush=gr.Brush(colors=["#ff0000"], default_size=180),
|
| 866 |
-
# elem_classes=["upload-area"]
|
| 867 |
-
# )
|
| 868 |
-
|
| 869 |
-
# gr.Markdown("### βοΈ Editing Instructions")
|
| 870 |
-
# local_prompt_input = gr.Textbox(
|
| 871 |
-
# label="Enter local editing prompt",
|
| 872 |
-
# placeholder="For example: change selected area hair to golden, add patterns to selected object, change selected area color, etc...",
|
| 873 |
-
# lines=3,
|
| 874 |
-
# max_lines=5
|
| 875 |
-
# )
|
| 876 |
-
|
| 877 |
-
# local_edit_button = gr.Button(
|
| 878 |
-
# "π― Start Local Editing",
|
| 879 |
-
# variant="primary",
|
| 880 |
-
# size="lg"
|
| 881 |
-
# )
|
| 882 |
-
|
| 883 |
-
# with gr.Column(scale=1):
|
| 884 |
-
# gr.Markdown("### π― Editing Result")
|
| 885 |
-
# local_output_image = gr.Image(
|
| 886 |
-
# label="Local edited image",
|
| 887 |
-
# height=320,
|
| 888 |
-
# elem_classes=["result-area"]
|
| 889 |
-
# )
|
| 890 |
-
|
| 891 |
-
# # Add "Use as Input" button
|
| 892 |
-
# local_use_as_input_btn = gr.Button(
|
| 893 |
-
# "π Use as Input",
|
| 894 |
-
# variant="secondary",
|
| 895 |
-
# size="sm",
|
| 896 |
-
# elem_classes=["use-as-input-btn"]
|
| 897 |
-
# )
|
| 898 |
-
|
| 899 |
-
# local_status_output = gr.Textbox(
|
| 900 |
-
# label="Processing status",
|
| 901 |
-
# lines=2,
|
| 902 |
-
# max_lines=3,
|
| 903 |
-
# interactive=False
|
| 904 |
-
# )
|
| 905 |
-
|
| 906 |
-
# Action buttons that will show after task completion
|
| 907 |
-
# local_action_buttons = gr.HTML(visible=False)
|
| 908 |
-
|
| 909 |
-
# # Local editing examples
|
| 910 |
-
# gr.Markdown("### π‘ Local Editing Prompt Examples")
|
| 911 |
-
# with gr.Row():
|
| 912 |
-
# local_example_prompts = [
|
| 913 |
-
# "Change selected area hair to golden",
|
| 914 |
-
# "Add pattern designs to selected clothing",
|
| 915 |
-
# "Change selected area to different material",
|
| 916 |
-
# "Add decorations to selected object",
|
| 917 |
-
# "Change selected area color and style"
|
| 918 |
-
# ]
|
| 919 |
-
|
| 920 |
-
# for prompt in local_example_prompts:
|
| 921 |
-
# gr.Button(
|
| 922 |
-
# prompt,
|
| 923 |
-
# size="sm"
|
| 924 |
-
# ).click(
|
| 925 |
-
# lambda p=prompt: p,
|
| 926 |
-
# outputs=local_prompt_input
|
| 927 |
-
# )
|
| 928 |
|
| 929 |
-
#
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
# concurrency_limit=8, # Local editing is more complex, allow fewer concurrent requests
|
| 937 |
-
# api_name="local_edit"
|
| 938 |
-
# )
|
| 939 |
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
# "layers": [],
|
| 947 |
-
# "composite": output_img
|
| 948 |
-
# }
|
| 949 |
-
# return editor_data
|
| 950 |
-
# return None
|
| 951 |
|
| 952 |
-
#
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 957 |
|
| 958 |
# SEO Content Section
|
| 959 |
gr.HTML("""
|
| 960 |
<div style="width: 100%; margin: 50px 0; padding: 0 20px;">
|
| 961 |
|
| 962 |
-
<!-- Showcase Section -->
|
| 963 |
<div style="text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px; border-radius: 20px; margin: 40px 0;">
|
| 964 |
<h2 style="margin: 0 0 20px 0; font-size: 2.2em; font-weight: 700;">
|
| 965 |
-
|
| 966 |
</h2>
|
| 967 |
<p style="margin: 0 0 25px 0; font-size: 1.2em; opacity: 0.95; line-height: 1.6;">
|
| 968 |
Experience the ultimate freedom in AI image creation! Generate and edit unlimited images without restrictions,
|
|
@@ -988,7 +933,7 @@ def create_app():
|
|
| 988 |
border: none;
|
| 989 |
transform: scale(1);
|
| 990 |
" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
|
| 991 |
-
|
| 992 |
</a>
|
| 993 |
|
| 994 |
</div>
|
|
@@ -998,10 +943,9 @@ def create_app():
|
|
| 998 |
</p>
|
| 999 |
</div>
|
| 1000 |
|
| 1001 |
-
<!-- Hero Description -->
|
| 1002 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); padding: 35px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 1003 |
<h2 style="color: #2c3e50; margin: 0 0 20px 0; font-size: 1.9em; font-weight: 700;">
|
| 1004 |
-
|
| 1005 |
</h2>
|
| 1006 |
<p style="color: #555; font-size: 1.1em; line-height: 1.6; margin: 0 0 20px 0; padding: 0 20px;">
|
| 1007 |
Transform your creative vision into reality with our advanced AI image editing platform. Whether you're creating
|
|
@@ -1010,12 +954,11 @@ def create_app():
|
|
| 1010 |
</p>
|
| 1011 |
</div>
|
| 1012 |
|
| 1013 |
-
<!-- Features Grid -->
|
| 1014 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; margin: 40px 0;">
|
| 1015 |
|
| 1016 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #e74c3c;">
|
| 1017 |
<h3 style="color: #e74c3c; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 1018 |
-
|
| 1019 |
</h3>
|
| 1020 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 1021 |
Premium users enjoy unlimited image generation without daily limits, rate restrictions, or content barriers.
|
|
@@ -1035,7 +978,7 @@ def create_app():
|
|
| 1035 |
|
| 1036 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #27ae60;">
|
| 1037 |
<h3 style="color: #27ae60; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 1038 |
-
|
| 1039 |
</h3>
|
| 1040 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 1041 |
Advanced AI infrastructure delivers high-quality results in seconds. No waiting in queues,
|
|
@@ -1045,7 +988,7 @@ def create_app():
|
|
| 1045 |
|
| 1046 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #9b59b6;">
|
| 1047 |
<h3 style="color: #9b59b6; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 1048 |
-
|
| 1049 |
</h3>
|
| 1050 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 1051 |
Global transformations, precision local editing, style transfer, object removal, background replacement,
|
|
@@ -1055,7 +998,7 @@ def create_app():
|
|
| 1055 |
|
| 1056 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #f39c12;">
|
| 1057 |
<h3 style="color: #f39c12; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 1058 |
-
|
| 1059 |
</h3>
|
| 1060 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 1061 |
State-of-the-art AI models trained on millions of images deliver exceptional quality and realism.
|
|
@@ -1075,10 +1018,9 @@ def create_app():
|
|
| 1075 |
|
| 1076 |
</div>
|
| 1077 |
|
| 1078 |
-
<!-- Premium Benefits Section -->
|
| 1079 |
<div style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; padding: 40px; border-radius: 20px; margin: 40px 0; text-align: center;">
|
| 1080 |
<h2 style="margin: 0 0 25px 0; font-size: 1.8em; font-weight: 700;">
|
| 1081 |
-
|
| 1082 |
</h2>
|
| 1083 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 30px 0;">
|
| 1084 |
|
|
@@ -1093,12 +1035,12 @@ def create_app():
|
|
| 1093 |
</div>
|
| 1094 |
|
| 1095 |
<div style="background: rgba(255,255,255,0.15); padding: 20px; border-radius: 12px;">
|
| 1096 |
-
<h4 style="margin: 0 0 10px 0; font-size: 1.2em;"
|
| 1097 |
<p style="margin: 0; opacity: 0.9; font-size: 0.95em;">Skip queues and get instant results with dedicated processing power</p>
|
| 1098 |
</div>
|
| 1099 |
|
| 1100 |
<div style="background: rgba(255,255,255,0.15); padding: 20px; border-radius: 12px;">
|
| 1101 |
-
<h4 style="margin: 0 0 10px 0; font-size: 1.2em;"
|
| 1102 |
<p style="margin: 0; opacity: 0.9; font-size: 0.95em;">Access to latest AI models and cutting-edge editing capabilities</p>
|
| 1103 |
</div>
|
| 1104 |
|
|
@@ -1120,14 +1062,13 @@ def create_app():
|
|
| 1120 |
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
|
| 1121 |
transition: all 0.3s ease;
|
| 1122 |
border: none;
|
| 1123 |
-
"
|
| 1124 |
</div>
|
| 1125 |
</div>
|
| 1126 |
|
| 1127 |
-
<!-- Tips Section -->
|
| 1128 |
<div style="background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%); padding: 30px; border-radius: 15px; margin: 40px 0;">
|
| 1129 |
<h3 style="color: #8b5cf6; text-align: center; margin: 0 0 25px 0; font-size: 1.5em; font-weight: 700;">
|
| 1130 |
-
|
| 1131 |
</h3>
|
| 1132 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px;">
|
| 1133 |
|
|
@@ -1137,27 +1078,26 @@ def create_app():
|
|
| 1137 |
</div>
|
| 1138 |
|
| 1139 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1140 |
-
<strong style="color: #8b5cf6; font-size: 1.1em;"
|
| 1141 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Use precise brush strokes to select areas for local editing. Smaller, focused edits often yield better results.</p>
|
| 1142 |
</div>
|
| 1143 |
|
| 1144 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1145 |
-
<strong style="color: #8b5cf6; font-size: 1.1em;"
|
| 1146 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Use "Use as Input" feature to refine results. Multiple iterations can achieve complex transformations.</p>
|
| 1147 |
</div>
|
| 1148 |
|
| 1149 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1150 |
-
<strong style="color: #8b5cf6; font-size: 1.1em;"
|
| 1151 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Higher resolution input images (up to 10MB) generally produce better editing results and finer details.</p>
|
| 1152 |
</div>
|
| 1153 |
|
| 1154 |
</div>
|
| 1155 |
</div>
|
| 1156 |
|
| 1157 |
-
<!-- Use Cases Section -->
|
| 1158 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); padding: 35px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 1159 |
<h2 style="color: #2c3e50; margin: 0 0 20px 0; font-size: 1.8em; font-weight: 700;">
|
| 1160 |
-
|
| 1161 |
</h2>
|
| 1162 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin: 25px 0; text-align: left;">
|
| 1163 |
|
|
@@ -1225,7 +1165,6 @@ def create_app():
|
|
| 1225 |
|
| 1226 |
</div>
|
| 1227 |
|
| 1228 |
-
<!-- Powered by footer -->
|
| 1229 |
<div style="text-align: center; margin: 30px auto 20px auto; padding: 20px;">
|
| 1230 |
<p style="margin: 0 0 10px 0; font-size: 18px; color: #333; font-weight: 500;">
|
| 1231 |
Powered by <a href="https://omnicreator.net/#generator" target="_blank" style="color: #667eea; text-decoration: none; font-weight: bold;">Omni Creator</a>
|
|
@@ -1253,4 +1192,4 @@ if __name__ == "__main__":
|
|
| 1253 |
max_threads=40, # Increase thread pool size
|
| 1254 |
height=800,
|
| 1255 |
favicon_path=None # Reduce resource loading
|
| 1256 |
-
)
|
|
|
|
| 8 |
from nfsw import NSFWDetector
|
| 9 |
|
| 10 |
# Configuration parameters
|
| 11 |
+
FREE_TRY_N = 15 # Free phase: first 15 tries without restrictions
|
| 12 |
+
SLOW_TRY_N = 25 # Slow phase start: 25 tries
|
| 13 |
+
SLOW2_TRY_N = 32 # Slow phase start: 32 tries
|
| 14 |
+
RATE_LIMIT_60 = 40 # Full restriction: blocked after 40 tries
|
| 15 |
|
| 16 |
# Time window configuration (minutes)
|
| 17 |
+
PHASE_1_WINDOW = 5 # 15-25 tries: 5 minutes
|
| 18 |
+
PHASE_2_WINDOW = 10 # 25-32 tries: 10 minutes
|
| 19 |
+
PHASE_3_WINDOW = 20 # 32-40 tries: 20 minutes
|
| 20 |
MAX_IMAGES_PER_WINDOW = 2 # Max images per time window
|
| 21 |
|
| 22 |
IP_Dict = {}
|
|
|
|
| 50 |
"""
|
| 51 |
count = get_ip_generation_count(client_ip)
|
| 52 |
|
| 53 |
+
if count < FREE_TRY_N:
|
| 54 |
return 'free'
|
| 55 |
+
elif count < SLOW_TRY_N:
|
| 56 |
+
return 'rate_limit_1' # NSFW blur + 5 minutes 2 images
|
| 57 |
+
elif count < SLOW2_TRY_N:
|
| 58 |
+
return 'rate_limit_2' # NSFW blur + 10 minutes 2 images
|
| 59 |
+
elif count < RATE_LIMIT_60:
|
| 60 |
+
return 'rate_limit_3' # NSFW blur + 20 minutes 2 images
|
| 61 |
+
else:
|
| 62 |
return 'blocked' # Generation blocked
|
| 63 |
|
| 64 |
def check_rate_limit_for_phase(client_ip, phase):
|
|
|
|
| 73 |
|
| 74 |
# Determine time window
|
| 75 |
if phase == 'rate_limit_1':
|
| 76 |
+
window_minutes = PHASE_1_WINDOW
|
| 77 |
elif phase == 'rate_limit_2':
|
| 78 |
+
window_minutes = PHASE_2_WINDOW
|
| 79 |
else: # rate_limit_3
|
| 80 |
+
window_minutes = PHASE_3_WINDOW
|
| 81 |
|
| 82 |
current_time = time.time()
|
| 83 |
window_key = f"{client_ip}_{phase}"
|
|
|
|
| 231 |
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
|
| 232 |
transition: all 0.3s ease;
|
| 233 |
border: none;
|
| 234 |
+
'>🚀 Unlimited Generation</a>
|
| 235 |
</div>
|
| 236 |
"""
|
| 237 |
return None, f"β You have reached Hugging Face's free generation limit. Please visit https://omnicreator.net/#generator for unlimited generation", gr.update(value=blocked_button_html, visible=True)
|
|
|
|
| 292 |
status_message = message
|
| 293 |
# Add error handling to prevent progress update failure
|
| 294 |
if progress is not None:
|
| 295 |
+
# Enhanced progress display with better formatting
|
| 296 |
+
if "Queue:" in message or "tasks ahead" in message:
|
| 297 |
+
# Queue status - show with different progress value to indicate waiting
|
| 298 |
+
progress(0.1, desc=message)
|
| 299 |
+
elif "Processing" in message or "AI is processing" in message:
|
| 300 |
+
# Processing status
|
| 301 |
+
progress(0.7, desc=message)
|
| 302 |
+
elif "Generating" in message or "Almost done" in message:
|
| 303 |
+
# Generation status
|
| 304 |
+
progress(0.9, desc=message)
|
| 305 |
+
else:
|
| 306 |
+
# Default status
|
| 307 |
+
progress(0.5, desc=message)
|
| 308 |
except Exception as e:
|
| 309 |
print(f"β οΈ Progress update failed: {e}")
|
| 310 |
|
|
|
|
| 416 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 417 |
transition: all 0.3s ease;
|
| 418 |
border: none;
|
| 419 |
+
'>🖼 Download HD Image</a>
|
| 420 |
<a href='https://omnicreator.net/#generator' target='_blank' style='
|
| 421 |
display: inline-flex;
|
| 422 |
align-items: center;
|
|
|
|
| 433 |
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 434 |
transition: all 0.3s ease;
|
| 435 |
border: none;
|
| 436 |
+
'>🚀 Unlimited Generation</a>
|
| 437 |
</div>
|
| 438 |
"""
|
| 439 |
|
|
|
|
| 510 |
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
|
| 511 |
transition: all 0.3s ease;
|
| 512 |
border: none;
|
| 513 |
+
'>🚀 Unlimited Generation</a>
|
| 514 |
</div>
|
| 515 |
"""
|
| 516 |
return None, f"β You have reached Hugging Face's free generation limit. Please visit https://omnicreator.net/#generator for unlimited generation", gr.update(value=blocked_button_html, visible=True)
|
|
|
|
| 571 |
status_message = message
|
| 572 |
# Add error handling to prevent progress update failure
|
| 573 |
if progress is not None:
|
| 574 |
+
# Enhanced progress display with better formatting for local editing
|
| 575 |
+
if "Queue:" in message or "tasks ahead" in message:
|
| 576 |
+
# Queue status - show with different progress value to indicate waiting
|
| 577 |
+
progress(0.1, desc=message)
|
| 578 |
+
elif "Processing" in message or "AI is processing" in message:
|
| 579 |
+
# Processing status
|
| 580 |
+
progress(0.7, desc=message)
|
| 581 |
+
elif "Generating" in message or "Almost done" in message:
|
| 582 |
+
# Generation status
|
| 583 |
+
progress(0.9, desc=message)
|
| 584 |
+
else:
|
| 585 |
+
# Default status
|
| 586 |
+
progress(0.5, desc=message)
|
| 587 |
except Exception as e:
|
| 588 |
print(f"β οΈ Local edit progress update failed: {e}")
|
| 589 |
|
|
|
|
| 695 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 696 |
transition: all 0.3s ease;
|
| 697 |
border: none;
|
| 698 |
+
'>🖼 Download HD Image</a>
|
| 699 |
<a href='https://omnicreator.net/#generator' target='_blank' style='
|
| 700 |
display: inline-flex;
|
| 701 |
align-items: center;
|
|
|
|
| 712 |
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 713 |
transition: all 0.3s ease;
|
| 714 |
border: none;
|
| 715 |
+
'>🚀 Unlimited Generation</a>
|
| 716 |
</div>
|
| 717 |
"""
|
| 718 |
|
|
|
|
| 772 |
</div>
|
| 773 |
""", padding=False)
|
| 774 |
|
| 775 |
+
# π NEW: Multi-Image Editing Announcement Banner with breathing effect
|
| 776 |
gr.HTML("""
|
| 777 |
+
<style>
|
| 778 |
+
@keyframes breathe {
|
| 779 |
+
0%, 100% { transform: scale(1); }
|
| 780 |
+
50% { transform: scale(1.02); }
|
| 781 |
+
}
|
| 782 |
+
.breathing-banner {
|
| 783 |
+
animation: breathe 3s ease-in-out infinite;
|
| 784 |
+
}
|
| 785 |
+
</style>
|
| 786 |
+
<div class="breathing-banner" style="
|
| 787 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 788 |
+
margin: 5px auto 5px auto;
|
| 789 |
+
padding: 6px 40px;
|
| 790 |
+
border-radius: 20px;
|
| 791 |
+
max-width: 700px;
|
| 792 |
+
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
|
| 793 |
+
text-align: center;
|
| 794 |
+
">
|
| 795 |
+
<span style="color: white; font-weight: 600; font-size: 1.0em;">
|
| 796 |
+
π NEW:
|
| 797 |
+
<a href="https://huggingface.co/spaces/Selfit/Multi-Image-Edit" target="_blank" style="
|
| 798 |
+
color: white;
|
| 799 |
+
text-decoration: none;
|
| 800 |
+
border-bottom: 1px solid rgba(255,255,255,0.5);
|
| 801 |
+
transition: all 0.3s ease;
|
| 802 |
+
" onmouseover="this.style.borderBottom='1px solid white'"
|
| 803 |
+
onmouseout="this.style.borderBottom='1px solid rgba(255,255,255,0.5)'">
|
| 804 |
+
Multi-Image AI Editor - World's First Multi-Image Editing Tool β
|
| 805 |
+
</a>
|
| 806 |
+
</span>
|
| 807 |
</div>
|
| 808 |
""", padding=False)
|
| 809 |
|
| 810 |
+
# Direct interface - no tabs needed
|
| 811 |
+
with gr.Row():
|
| 812 |
+
with gr.Column(scale=1):
|
| 813 |
+
gr.Markdown("### πΈ Upload Image")
|
| 814 |
+
input_image = gr.Image(
|
| 815 |
+
label="Select image to edit",
|
| 816 |
+
type="pil",
|
| 817 |
+
height=512,
|
| 818 |
+
elem_classes=["upload-area"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 819 |
)
|
| 820 |
|
| 821 |
+
gr.Markdown("### βοΈ Editing Instructions")
|
| 822 |
+
prompt_input = gr.Textbox(
|
| 823 |
+
label="Enter editing prompt",
|
| 824 |
+
placeholder="For example: change background to beach, add rainbow, remove background, etc...",
|
| 825 |
+
lines=3,
|
| 826 |
+
max_lines=5
|
| 827 |
+
)
|
| 828 |
|
| 829 |
+
edit_button = gr.Button(
|
| 830 |
+
"π Start Editing",
|
| 831 |
+
variant="primary",
|
| 832 |
+
size="lg"
|
| 833 |
)
|
| 834 |
|
| 835 |
+
with gr.Column(scale=1):
|
| 836 |
+
gr.Markdown("### π― Editing Result")
|
| 837 |
+
output_image = gr.Image(
|
| 838 |
+
label="Edited image",
|
| 839 |
+
height=320,
|
| 840 |
+
elem_classes=["result-area"]
|
| 841 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
|
| 843 |
+
# Add "Use as Input" button
|
| 844 |
+
use_as_input_btn = gr.Button(
|
| 845 |
+
"π Use as Input",
|
| 846 |
+
variant="secondary",
|
| 847 |
+
size="sm",
|
| 848 |
+
elem_classes=["use-as-input-btn"]
|
| 849 |
+
)
|
|
|
|
|
|
|
|
|
|
| 850 |
|
| 851 |
+
status_output = gr.Textbox(
|
| 852 |
+
label="Processing status",
|
| 853 |
+
lines=2,
|
| 854 |
+
max_lines=3,
|
| 855 |
+
interactive=False
|
| 856 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 857 |
|
| 858 |
+
# Action buttons that will show after task completion
|
| 859 |
+
action_buttons = gr.HTML(visible=False)
|
| 860 |
+
|
| 861 |
+
# Example area
|
| 862 |
+
gr.Markdown("### π‘ Prompt Examples")
|
| 863 |
+
with gr.Row():
|
| 864 |
+
example_prompts = [
|
| 865 |
+
"Set the background to a grand opera stage with red curtains",
|
| 866 |
+
"Change the outfit into a traditional Chinese hanfu with flowing sleeves",
|
| 867 |
+
"Give the character blue dragon-like eyes with glowing pupils",
|
| 868 |
+
"Change lighting to soft dreamy pastel glow",
|
| 869 |
+
"Change pose to sitting cross-legged on the ground"
|
| 870 |
+
]
|
| 871 |
+
|
| 872 |
+
for prompt in example_prompts:
|
| 873 |
+
gr.Button(
|
| 874 |
+
prompt,
|
| 875 |
+
size="sm"
|
| 876 |
+
).click(
|
| 877 |
+
lambda p=prompt: p,
|
| 878 |
+
outputs=prompt_input
|
| 879 |
+
)
|
| 880 |
+
|
| 881 |
+
# Bind button click events - simplified, remove state management
|
| 882 |
+
edit_button.click(
|
| 883 |
+
fn=edit_image_interface,
|
| 884 |
+
inputs=[input_image, prompt_input],
|
| 885 |
+
outputs=[output_image, status_output, action_buttons],
|
| 886 |
+
show_progress=True,
|
| 887 |
+
# Increase concurrency settings
|
| 888 |
+
concurrency_limit=10, # Limit concurrent requests
|
| 889 |
+
api_name="global_edit"
|
| 890 |
+
)
|
| 891 |
+
|
| 892 |
+
# Simplify "Use as Input" button, directly copy image
|
| 893 |
+
def simple_use_as_input(output_img):
|
| 894 |
+
if output_img is not None:
|
| 895 |
+
return output_img
|
| 896 |
+
return None
|
| 897 |
+
|
| 898 |
+
use_as_input_btn.click(
|
| 899 |
+
fn=simple_use_as_input,
|
| 900 |
+
inputs=[output_image],
|
| 901 |
+
outputs=[input_image]
|
| 902 |
+
)
|
| 903 |
|
| 904 |
# SEO Content Section
|
| 905 |
gr.HTML("""
|
| 906 |
<div style="width: 100%; margin: 50px 0; padding: 0 20px;">
|
| 907 |
|
|
|
|
| 908 |
<div style="text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px; border-radius: 20px; margin: 40px 0;">
|
| 909 |
<h2 style="margin: 0 0 20px 0; font-size: 2.2em; font-weight: 700;">
|
| 910 |
+
🎨 Unlimited AI Image Generation & Editing
|
| 911 |
</h2>
|
| 912 |
<p style="margin: 0 0 25px 0; font-size: 1.2em; opacity: 0.95; line-height: 1.6;">
|
| 913 |
Experience the ultimate freedom in AI image creation! Generate and edit unlimited images without restrictions,
|
|
|
|
| 933 |
border: none;
|
| 934 |
transform: scale(1);
|
| 935 |
" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
|
| 936 |
+
🚀 Get Unlimited Access Now
|
| 937 |
</a>
|
| 938 |
|
| 939 |
</div>
|
|
|
|
| 943 |
</p>
|
| 944 |
</div>
|
| 945 |
|
|
|
|
| 946 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); padding: 35px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 947 |
<h2 style="color: #2c3e50; margin: 0 0 20px 0; font-size: 1.9em; font-weight: 700;">
|
| 948 |
+
⭐ Professional AI Image Editor - No Restrictions
|
| 949 |
</h2>
|
| 950 |
<p style="color: #555; font-size: 1.1em; line-height: 1.6; margin: 0 0 20px 0; padding: 0 20px;">
|
| 951 |
Transform your creative vision into reality with our advanced AI image editing platform. Whether you're creating
|
|
|
|
| 954 |
</p>
|
| 955 |
</div>
|
| 956 |
|
|
|
|
| 957 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; margin: 40px 0;">
|
| 958 |
|
| 959 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #e74c3c;">
|
| 960 |
<h3 style="color: #e74c3c; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 961 |
+
🎯 Unlimited Generation
|
| 962 |
</h3>
|
| 963 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 964 |
Premium users enjoy unlimited image generation without daily limits, rate restrictions, or content barriers.
|
|
|
|
| 978 |
|
| 979 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #27ae60;">
|
| 980 |
<h3 style="color: #27ae60; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 981 |
+
⚡ Lightning Fast Processing
|
| 982 |
</h3>
|
| 983 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 984 |
Advanced AI infrastructure delivers high-quality results in seconds. No waiting in queues,
|
|
|
|
| 988 |
|
| 989 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #9b59b6;">
|
| 990 |
<h3 style="color: #9b59b6; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 991 |
+
🎨 Advanced Editing Tools
|
| 992 |
</h3>
|
| 993 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 994 |
Global transformations, precision local editing, style transfer, object removal, background replacement,
|
|
|
|
| 998 |
|
| 999 |
<div style="background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #f39c12;">
|
| 1000 |
<h3 style="color: #f39c12; margin: 0 0 15px 0; font-size: 1.4em; font-weight: 600;">
|
| 1001 |
+
💎 Premium Quality
|
| 1002 |
</h3>
|
| 1003 |
<p style="color: #666; margin: 0; line-height: 1.6; font-size: 1em;">
|
| 1004 |
State-of-the-art AI models trained on millions of images deliver exceptional quality and realism.
|
|
|
|
| 1018 |
|
| 1019 |
</div>
|
| 1020 |
|
|
|
|
| 1021 |
<div style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; padding: 40px; border-radius: 20px; margin: 40px 0; text-align: center;">
|
| 1022 |
<h2 style="margin: 0 0 25px 0; font-size: 1.8em; font-weight: 700;">
|
| 1023 |
+
💎 Why Choose Omni Creator Premium?
|
| 1024 |
</h2>
|
| 1025 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 30px 0;">
|
| 1026 |
|
|
|
|
| 1035 |
</div>
|
| 1036 |
|
| 1037 |
<div style="background: rgba(255,255,255,0.15); padding: 20px; border-radius: 12px;">
|
| 1038 |
+
<h4 style="margin: 0 0 10px 0; font-size: 1.2em;">⚡ Priority Processing</h4>
|
| 1039 |
<p style="margin: 0; opacity: 0.9; font-size: 0.95em;">Skip queues and get instant results with dedicated processing power</p>
|
| 1040 |
</div>
|
| 1041 |
|
| 1042 |
<div style="background: rgba(255,255,255,0.15); padding: 20px; border-radius: 12px;">
|
| 1043 |
+
<h4 style="margin: 0 0 10px 0; font-size: 1.2em;">🎨 Advanced Features</h4>
|
| 1044 |
<p style="margin: 0; opacity: 0.9; font-size: 0.95em;">Access to latest AI models and cutting-edge editing capabilities</p>
|
| 1045 |
</div>
|
| 1046 |
|
|
|
|
| 1062 |
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
|
| 1063 |
transition: all 0.3s ease;
|
| 1064 |
border: none;
|
| 1065 |
+
">⭐ Start Creating Now</a>
|
| 1066 |
</div>
|
| 1067 |
</div>
|
| 1068 |
|
|
|
|
| 1069 |
<div style="background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%); padding: 30px; border-radius: 15px; margin: 40px 0;">
|
| 1070 |
<h3 style="color: #8b5cf6; text-align: center; margin: 0 0 25px 0; font-size: 1.5em; font-weight: 700;">
|
| 1071 |
+
💡 Pro Tips for Best Results
|
| 1072 |
</h3>
|
| 1073 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px;">
|
| 1074 |
|
|
|
|
| 1078 |
</div>
|
| 1079 |
|
| 1080 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1081 |
+
<strong style="color: #8b5cf6; font-size: 1.1em;">🎯 Local Editing:</strong>
|
| 1082 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Use precise brush strokes to select areas for local editing. Smaller, focused edits often yield better results.</p>
|
| 1083 |
</div>
|
| 1084 |
|
| 1085 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1086 |
+
<strong style="color: #8b5cf6; font-size: 1.1em;">⚡ Iterative Process:</strong>
|
| 1087 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Use "Use as Input" feature to refine results. Multiple iterations can achieve complex transformations.</p>
|
| 1088 |
</div>
|
| 1089 |
|
| 1090 |
<div style="background: rgba(255,255,255,0.85); padding: 18px; border-radius: 12px;">
|
| 1091 |
+
<strong style="color: #8b5cf6; font-size: 1.1em;">🖼 Image Quality:</strong>
|
| 1092 |
<p style="color: #555; margin: 5px 0 0 0; line-height: 1.5;">Higher resolution input images (up to 10MB) generally produce better editing results and finer details.</p>
|
| 1093 |
</div>
|
| 1094 |
|
| 1095 |
</div>
|
| 1096 |
</div>
|
| 1097 |
|
|
|
|
| 1098 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); padding: 35px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 1099 |
<h2 style="color: #2c3e50; margin: 0 0 20px 0; font-size: 1.8em; font-weight: 700;">
|
| 1100 |
+
🚀 Perfect For Every Creative Need
|
| 1101 |
</h2>
|
| 1102 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin: 25px 0; text-align: left;">
|
| 1103 |
|
|
|
|
| 1165 |
|
| 1166 |
</div>
|
| 1167 |
|
|
|
|
| 1168 |
<div style="text-align: center; margin: 30px auto 20px auto; padding: 20px;">
|
| 1169 |
<p style="margin: 0 0 10px 0; font-size: 18px; color: #333; font-weight: 500;">
|
| 1170 |
Powered by <a href="https://omnicreator.net/#generator" target="_blank" style="color: #667eea; text-decoration: none; font-weight: bold;">Omni Creator</a>
|
|
|
|
| 1192 |
max_threads=40, # Increase thread pool size
|
| 1193 |
height=800,
|
| 1194 |
favicon_path=None # Reduce resource loading
|
| 1195 |
+
)
|
util.py
CHANGED
|
@@ -384,7 +384,18 @@ def check_task_status(task_id):
|
|
| 384 |
result = response.json()
|
| 385 |
if result.get('code') == 0:
|
| 386 |
task_data = result['data']
|
| 387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
else:
|
| 389 |
return 'error', None, result.get('message', 'Unknown error')
|
| 390 |
elif response.status_code in [502, 503, 504]: # ζε‘ε¨ιθ――οΌε―δ»₯ιθ―
|
|
@@ -476,8 +487,25 @@ def process_image_edit(img_input, prompt, progress_callback=None):
|
|
| 476 |
elif status == 'error' or status == 'failed':
|
| 477 |
return None, f"task processing failed: {task_data}", task_uuid
|
| 478 |
elif status in ['queued', 'processing', 'running', 'created', 'working']:
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
time.sleep(1)
|
| 482 |
else:
|
| 483 |
if progress_callback:
|
|
@@ -578,8 +606,25 @@ def process_local_image_edit(base_image, layers, prompt, progress_callback=None)
|
|
| 578 |
elif status == 'error' or status == 'failed':
|
| 579 |
return None, f"task processing failed: {task_data}", task_uuid
|
| 580 |
elif status in ['queued', 'processing', 'running', 'created', 'working']:
|
| 581 |
-
|
| 582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
time.sleep(1) # Wait 1 second before retry
|
| 584 |
else:
|
| 585 |
if progress_callback:
|
|
|
|
| 384 |
result = response.json()
|
| 385 |
if result.get('code') == 0:
|
| 386 |
task_data = result['data']
|
| 387 |
+
status = task_data['status']
|
| 388 |
+
image_url = task_data.get('image_url')
|
| 389 |
+
|
| 390 |
+
# Extract and log queue information for better user feedback
|
| 391 |
+
queue_info = task_data.get('queue_info', {})
|
| 392 |
+
if queue_info:
|
| 393 |
+
tasks_ahead = queue_info.get('tasks_ahead', 0)
|
| 394 |
+
current_priority = queue_info.get('current_priority', 0)
|
| 395 |
+
description = queue_info.get('description', '')
|
| 396 |
+
print(f"π Queue Status - Tasks ahead: {tasks_ahead}, Priority: {current_priority}, Status: {status}")
|
| 397 |
+
|
| 398 |
+
return status, image_url, task_data
|
| 399 |
else:
|
| 400 |
return 'error', None, result.get('message', 'Unknown error')
|
| 401 |
elif response.status_code in [502, 503, 504]: # ζε‘ε¨ιθ――οΌε―δ»₯ιθ―
|
|
|
|
| 487 |
elif status == 'error' or status == 'failed':
|
| 488 |
return None, f"task processing failed: {task_data}", task_uuid
|
| 489 |
elif status in ['queued', 'processing', 'running', 'created', 'working']:
|
| 490 |
+
# Enhanced progress message with queue info and website promotion
|
| 491 |
+
if progress_callback and task_data and isinstance(task_data, dict):
|
| 492 |
+
queue_info = task_data.get('queue_info', {})
|
| 493 |
+
if queue_info and status in ['queued', 'created']:
|
| 494 |
+
tasks_ahead = queue_info.get('tasks_ahead', 0)
|
| 495 |
+
current_priority = queue_info.get('current_priority', 0)
|
| 496 |
+
if tasks_ahead > 0:
|
| 497 |
+
progress_callback(f"β³ Queue: {tasks_ahead} tasks ahead | Low priority | Visit website for instant processing β https://omnicreator.net/#generator")
|
| 498 |
+
else:
|
| 499 |
+
progress_callback(f"π Processing your image editing request...")
|
| 500 |
+
elif status == 'processing':
|
| 501 |
+
progress_callback(f"π¨ AI is processing... Please wait")
|
| 502 |
+
elif status in ['running', 'working']:
|
| 503 |
+
progress_callback(f"β‘ Generating... Almost done")
|
| 504 |
+
else:
|
| 505 |
+
progress_callback(f"π Task status: {status}")
|
| 506 |
+
else:
|
| 507 |
+
if progress_callback:
|
| 508 |
+
progress_callback(f"task processing... (status: {status})")
|
| 509 |
time.sleep(1)
|
| 510 |
else:
|
| 511 |
if progress_callback:
|
|
|
|
| 606 |
elif status == 'error' or status == 'failed':
|
| 607 |
return None, f"task processing failed: {task_data}", task_uuid
|
| 608 |
elif status in ['queued', 'processing', 'running', 'created', 'working']:
|
| 609 |
+
# Enhanced progress message with queue info and website promotion
|
| 610 |
+
if progress_callback and task_data and isinstance(task_data, dict):
|
| 611 |
+
queue_info = task_data.get('queue_info', {})
|
| 612 |
+
if queue_info and status in ['queued', 'created']:
|
| 613 |
+
tasks_ahead = queue_info.get('tasks_ahead', 0)
|
| 614 |
+
current_priority = queue_info.get('current_priority', 0)
|
| 615 |
+
if tasks_ahead > 0:
|
| 616 |
+
progress_callback(f"β³ Queue: {tasks_ahead} tasks ahead | Low priority | Visit website for instant processing β https://omnicreator.net/#generator")
|
| 617 |
+
else:
|
| 618 |
+
progress_callback(f"π Processing your local editing request...")
|
| 619 |
+
elif status == 'processing':
|
| 620 |
+
progress_callback(f"π¨ AI is processing... Please wait")
|
| 621 |
+
elif status in ['running', 'working']:
|
| 622 |
+
progress_callback(f"β‘ Generating... Almost done")
|
| 623 |
+
else:
|
| 624 |
+
progress_callback(f"π Task status: {status}")
|
| 625 |
+
else:
|
| 626 |
+
if progress_callback:
|
| 627 |
+
progress_callback(f"processing... (status: {status})")
|
| 628 |
time.sleep(1) # Wait 1 second before retry
|
| 629 |
else:
|
| 630 |
if progress_callback:
|