selfitcamera commited on
Commit
0cb9d4a
·
1 Parent(s): 6855df4
__lib__/app.py CHANGED
@@ -33,7 +33,7 @@ def t(key, lang="en"):
33
 
34
  # Configuration parameters
35
  # a = b
36
- TIP_TRY_N = 1 # Show like button tip after 12 tries
37
  FREE_TRY_N = 4 # Free phase: first 15 tries without restrictions
38
  SLOW_TRY_N = 6 # Slow phase start: 25 tries
39
  SLOW2_TRY_N = 10 # Slow phase start: 32 tries
@@ -623,7 +623,7 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
623
  '>⏰ Skip Wait - Unlimited Generation</a>
624
  </div>
625
  """
626
- return None, t("error_free_limit_wait", lang).format(wait_minutes_int=wait_minutes_int), gr.update(value=rate_limit_button_html, visible=True)
627
 
628
  # Handle NSFW detection based on phase
629
  is_nsfw_task = False # Track if this task involves NSFW content
@@ -635,6 +635,7 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
635
 
636
  if nsfw_result.lower() == "nsfw":
637
  is_nsfw_task = True
 
638
  print(f"🔍 Input NSFW detected in {current_phase} phase: ❌❌❌ {nsfw_result} - IP: {client_ip} (will blur result)")
639
  else:
640
  print(f"🔍 Input NSFW check passed: ✅✅✅ {nsfw_result} - IP: {client_ip}")
@@ -645,6 +646,7 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
645
 
646
  result_url = None
647
  status_message = ""
 
648
 
649
  def progress_callback(message):
650
  try:
@@ -716,7 +718,7 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
716
  # Use translated message or default
717
  limit_message = error_message if error_message else t("error_free_limit_reached", lang)
718
 
719
- return None, limit_message, gr.update(value=hf_limit_button_html, visible=True)
720
 
721
  if result_url:
722
  print(f"✅ Processing completed successfully - IP: {client_ip}, result_url: {result_url}, task_uuid: {task_uuid}", flush=True)
@@ -761,12 +763,27 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
761
  final_result = result_url
762
  final_message = t("warning_content_review", lang)
763
 
 
 
 
764
  # Generate NSFW button for blurred content with different URL for restricted countries
765
  if is_restricted or lang in ["hi", "ru", "zh"]:
766
  nsfw_url = GOOGLE_GEMINI_URL
767
  else:
768
  nsfw_url = 'https://omnicreator.net/#generator'
769
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  nsfw_action_buttons_html = f"""
771
  <div style='text-align: center; margin: 18px 0 10px 0;'>
772
  <a href='{nsfw_url}' target='_blank' style='
@@ -786,17 +803,9 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
786
  border: none;
787
  '>🔥 Unlimited Creative Generation</a>
788
  </div>
789
- <div style='margin: 14px auto 0; max-width: 640px; background: linear-gradient(120deg, #f0f4ff 0%, #e5edff 50%, #f7fbff 100%); border: 1px solid #cbd5ff; border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 25px rgba(88, 101, 242, 0.18); text-align: center;'>
790
- <div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>
791
- 🚀 Omni Image Editor 2.0 is live!
792
- </div>
793
- <a href='https://huggingface.co/spaces/selfit-camera/Omni-Image-Editor' target='_blank' style='display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; padding: 10px 18px; background: #5865f2; color: white; border-radius: 10px; font-weight: 800; text-decoration: none; box-shadow: 0 6px 18px rgba(88, 101, 242, 0.35);'>
794
- Try the Hugging Face Space demo (free)
795
- </a>
796
- <div style='font-size: 13px; color: #4a5568; margin-top: 6px; font-weight: 600;'>This is a free HF Space demo for Omni Image Editor 2.0.</div>
797
- </div>
798
  """
799
- return final_result, final_message, gr.update(value=nsfw_action_buttons_html, visible=True)
800
  else:
801
  final_result = result_url
802
  final_message = t("status_completed_message", lang).format(message=message)
@@ -808,40 +817,54 @@ def edit_image_interface(input_image, prompt, lang, request: gr.Request, progres
808
  print(f"⚠️ Final progress update failed: {e}")
809
 
810
  # Generate action buttons HTML
 
 
 
 
 
 
 
 
 
 
 
 
811
  action_buttons_html = ""
812
 
813
- # For restricted countries, only show like tip (no action buttons)
814
- if is_restricted:
815
- if show_like_tip:
816
- action_buttons_html = """
817
- <div style='display: flex; justify-content: center; margin: 15px 0 5px 0; padding: 0px;'>
818
- <div style='
819
- display: inline-flex;
820
- align-items: center;
821
- justify-content: center;
822
- padding: 12px 24px;
823
- background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
824
- color: white;
825
- text-decoration: none;
826
- border-radius: 10px;
827
- font-weight: 600;
828
- font-size: 14px;
829
- text-align: center;
830
- max-width: 400px;
831
- box-shadow: 0 3px 12px rgba(255, 107, 107, 0.3);
832
- border: none;
833
- '>👉 Click the ❤️ Like button to unlock more free trial attempts!</div>
834
- </div>
835
- """
 
 
836
 
837
- return final_result, final_message, gr.update(value=action_buttons_html, visible=True)
838
  else:
839
  print(f"❌ Processing failed - IP: {client_ip}, error: {message}", flush=True)
840
- return None, t("error_processing_failed", lang).format(message=message), gr.update(visible=False)
841
 
842
  except Exception as e:
843
  print(f"❌ Processing exception - IP: {client_ip}, error: {str(e)}")
844
- return None, t("error_processing_exception", lang).format(error=str(e)), gr.update(visible=False)
845
  finally:
846
  # Task finished (success or failure) — clear active marker to allow next submission immediately
847
  Active_Tasks.pop(client_ip, None)
 
33
 
34
  # Configuration parameters
35
  # a = b
36
+ TIP_TRY_N = 1 # Show like button tip after x tries
37
  FREE_TRY_N = 4 # Free phase: first 15 tries without restrictions
38
  SLOW_TRY_N = 6 # Slow phase start: 25 tries
39
  SLOW2_TRY_N = 10 # Slow phase start: 32 tries
 
623
  '>⏰ Skip Wait - Unlimited Generation</a>
624
  </div>
625
  """
626
+ return None, t("error_free_limit_wait", lang).format(wait_minutes_int=wait_minutes_int), gr.update(value=rate_limit_button_html, visible=True), use_as_input_state
627
 
628
  # Handle NSFW detection based on phase
629
  is_nsfw_task = False # Track if this task involves NSFW content
 
635
 
636
  if nsfw_result.lower() == "nsfw":
637
  is_nsfw_task = True
638
+ use_as_input_state = gr.update(interactive=False)
639
  print(f"🔍 Input NSFW detected in {current_phase} phase: ❌❌❌ {nsfw_result} - IP: {client_ip} (will blur result)")
640
  else:
641
  print(f"🔍 Input NSFW check passed: ✅✅✅ {nsfw_result} - IP: {client_ip}")
 
646
 
647
  result_url = None
648
  status_message = ""
649
+ use_as_input_state = gr.update(interactive=True)
650
 
651
  def progress_callback(message):
652
  try:
 
718
  # Use translated message or default
719
  limit_message = error_message if error_message else t("error_free_limit_reached", lang)
720
 
721
+ return None, limit_message, gr.update(value=hf_limit_button_html, visible=True), use_as_input_state
722
 
723
  if result_url:
724
  print(f"✅ Processing completed successfully - IP: {client_ip}, result_url: {result_url}, task_uuid: {task_uuid}", flush=True)
 
763
  final_result = result_url
764
  final_message = t("warning_content_review", lang)
765
 
766
+ # Disable use-as-input when NSFW content is detected
767
+ use_as_input_state = gr.update(interactive=False)
768
+
769
  # Generate NSFW button for blurred content with different URL for restricted countries
770
  if is_restricted or lang in ["hi", "ru", "zh"]:
771
  nsfw_url = GOOGLE_GEMINI_URL
772
  else:
773
  nsfw_url = 'https://omnicreator.net/#generator'
774
 
775
+ banner_html = """
776
+ <div style='margin: 14px auto 0; max-width: 640px; background: linear-gradient(120deg, #f0f4ff 0%, #e5edff 50%, #f7fbff 100%); border: 1px solid #cbd5ff; border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 25px rgba(88, 101, 242, 0.18); text-align: center;'>
777
+ <div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>
778
+ 🚀 Omni Image Editor 2.0 is live!
779
+ </div>
780
+ <a href='https://huggingface.co/spaces/selfit-camera/Omni-Image-Editor' target='_blank' style='display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; padding: 10px 18px; background: #5865f2; color: white; border-radius: 10px; font-weight: 800; text-decoration: none; box-shadow: 0 6px 18px rgba(88, 101, 242, 0.35);'>
781
+ Try the Hugging Face Space demo (free)
782
+ </a>
783
+ <div style='font-size: 13px; color: #4a5568; margin-top: 6px; font-weight: 600;'>This is a free HF Space demo for Omni Image Editor 2.0.</div>
784
+ </div>
785
+ """
786
+
787
  nsfw_action_buttons_html = f"""
788
  <div style='text-align: center; margin: 18px 0 10px 0;'>
789
  <a href='{nsfw_url}' target='_blank' style='
 
803
  border: none;
804
  '>🔥 Unlimited Creative Generation</a>
805
  </div>
806
+ {banner_html}
 
 
 
 
 
 
 
 
807
  """
808
+ return final_result, final_message, gr.update(value=nsfw_action_buttons_html, visible=True), use_as_input_state
809
  else:
810
  final_result = result_url
811
  final_message = t("status_completed_message", lang).format(message=message)
 
817
  print(f"⚠️ Final progress update failed: {e}")
818
 
819
  # Generate action buttons HTML
820
+ banner_html = """
821
+ <div style='margin: 14px auto 0; max-width: 640px; background: linear-gradient(120deg, #f0f4ff 0%, #e5edff 50%, #f7fbff 100%); border: 1px solid #cbd5ff; border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 25px rgba(88, 101, 242, 0.18); text-align: center;'>
822
+ <div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>
823
+ 🚀 Omni Image Editor 2.0 is live!
824
+ </div>
825
+ <a href='https://huggingface.co/spaces/selfit-camera/Omni-Image-Editor' target='_blank' style='display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; padding: 10px 18px; background: #5865f2; color: white; border-radius: 10px; font-weight: 800; text-decoration: none; box-shadow: 0 6px 18px rgba(88, 101, 242, 0.35);'>
826
+ Try the Hugging Face Space demo (free)
827
+ </a>
828
+ <div style='font-size: 13px; color: #4a5568; margin-top: 6px; font-weight: 600;'>This is a free HF Space demo for Omni Image Editor 2.0.</div>
829
+ </div>
830
+ """
831
+
832
  action_buttons_html = ""
833
 
834
+ # 根据 TIP_TRY_N(受限地区从第一次起就触发)展示点赞提示
835
+ if show_like_tip:
836
+ action_buttons_html = """
837
+ <div style='display: flex; justify-content: center; margin: 15px 0 5px 0; padding: 0px;'>
838
+ <div style='
839
+ display: inline-flex;
840
+ align-items: center;
841
+ justify-content: center;
842
+ padding: 12px 24px;
843
+ background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
844
+ color: white;
845
+ text-decoration: none;
846
+ border-radius: 10px;
847
+ font-weight: 600;
848
+ font-size: 14px;
849
+ text-align: center;
850
+ max-width: 400px;
851
+ box-shadow: 0 3px 12px rgba(255, 107, 107, 0.3);
852
+ border: none;
853
+ '>👉 Click the ❤️ Like button to unlock more free trial attempts!</div>
854
+ </div>
855
+ """
856
+
857
+ # Always show the Omni Image Editor 2.0 banner under the result image
858
+ action_buttons_html = f"{action_buttons_html}{banner_html}"
859
 
860
+ return final_result, final_message, gr.update(value=action_buttons_html, visible=True), use_as_input_state
861
  else:
862
  print(f"❌ Processing failed - IP: {client_ip}, error: {message}", flush=True)
863
+ return None, t("error_processing_failed", lang).format(message=message), gr.update(visible=False), use_as_input_state
864
 
865
  except Exception as e:
866
  print(f"❌ Processing exception - IP: {client_ip}, error: {str(e)}")
867
+ return None, t("error_processing_exception", lang).format(error=str(e)), gr.update(visible=False), use_as_input_state
868
  finally:
869
  # Task finished (success or failure) — clear active marker to allow next submission immediately
870
  Active_Tasks.pop(client_ip, None)
__lib__/i18n/ar.pyc CHANGED
Binary files a/__lib__/i18n/ar.pyc and b/__lib__/i18n/ar.pyc differ
 
__lib__/i18n/da.pyc CHANGED
Binary files a/__lib__/i18n/da.pyc and b/__lib__/i18n/da.pyc differ
 
__lib__/i18n/de.pyc CHANGED
Binary files a/__lib__/i18n/de.pyc and b/__lib__/i18n/de.pyc differ
 
__lib__/i18n/en.pyc CHANGED
Binary files a/__lib__/i18n/en.pyc and b/__lib__/i18n/en.pyc differ
 
__lib__/i18n/es.pyc CHANGED
Binary files a/__lib__/i18n/es.pyc and b/__lib__/i18n/es.pyc differ
 
__lib__/i18n/fi.pyc CHANGED
Binary files a/__lib__/i18n/fi.pyc and b/__lib__/i18n/fi.pyc differ
 
__lib__/i18n/fr.pyc CHANGED
Binary files a/__lib__/i18n/fr.pyc and b/__lib__/i18n/fr.pyc differ
 
__lib__/i18n/he.pyc CHANGED
Binary files a/__lib__/i18n/he.pyc and b/__lib__/i18n/he.pyc differ
 
__lib__/i18n/hi.pyc CHANGED
Binary files a/__lib__/i18n/hi.pyc and b/__lib__/i18n/hi.pyc differ
 
__lib__/i18n/id.pyc CHANGED
Binary files a/__lib__/i18n/id.pyc and b/__lib__/i18n/id.pyc differ
 
__lib__/i18n/it.pyc CHANGED
Binary files a/__lib__/i18n/it.pyc and b/__lib__/i18n/it.pyc differ
 
__lib__/i18n/ja.pyc CHANGED
Binary files a/__lib__/i18n/ja.pyc and b/__lib__/i18n/ja.pyc differ
 
__lib__/i18n/nl.pyc CHANGED
Binary files a/__lib__/i18n/nl.pyc and b/__lib__/i18n/nl.pyc differ
 
__lib__/i18n/no.pyc CHANGED
Binary files a/__lib__/i18n/no.pyc and b/__lib__/i18n/no.pyc differ
 
__lib__/i18n/pt.pyc CHANGED
Binary files a/__lib__/i18n/pt.pyc and b/__lib__/i18n/pt.pyc differ
 
__lib__/i18n/ru.pyc CHANGED
Binary files a/__lib__/i18n/ru.pyc and b/__lib__/i18n/ru.pyc differ
 
__lib__/i18n/sv.pyc CHANGED
Binary files a/__lib__/i18n/sv.pyc and b/__lib__/i18n/sv.pyc differ
 
__lib__/i18n/tr.pyc CHANGED
Binary files a/__lib__/i18n/tr.pyc and b/__lib__/i18n/tr.pyc differ
 
__lib__/i18n/uk.pyc CHANGED
Binary files a/__lib__/i18n/uk.pyc and b/__lib__/i18n/uk.pyc differ
 
__lib__/i18n/vi.pyc CHANGED
Binary files a/__lib__/i18n/vi.pyc and b/__lib__/i18n/vi.pyc differ
 
__lib__/i18n/zh.pyc CHANGED
Binary files a/__lib__/i18n/zh.pyc and b/__lib__/i18n/zh.pyc differ