Spaces:
Runtime error
Runtime error
Commit ·
0cb9d4a
1
Parent(s): 6855df4
init
Browse filesFiles changed (22)
- __lib__/app.py+62-39
- __lib__/i18n/ar.pyc
- __lib__/i18n/da.pyc
- __lib__/i18n/de.pyc
- __lib__/i18n/en.pyc
- __lib__/i18n/es.pyc
- __lib__/i18n/fi.pyc
- __lib__/i18n/fr.pyc
- __lib__/i18n/he.pyc
- __lib__/i18n/hi.pyc
- __lib__/i18n/id.pyc
- __lib__/i18n/it.pyc
- __lib__/i18n/ja.pyc
- __lib__/i18n/nl.pyc
- __lib__/i18n/no.pyc
- __lib__/i18n/pt.pyc
- __lib__/i18n/ru.pyc
- __lib__/i18n/sv.pyc
- __lib__/i18n/tr.pyc
- __lib__/i18n/uk.pyc
- __lib__/i18n/vi.pyc
- __lib__/i18n/zh.pyc
32 unmodified lines33343536373839583 unmodified lines6236246256266276286295 unmodified lines6356366376386396404 unmodified lines64564664764864965065 unmodified lines71671771871972072172238 unmodified lines76176276376476576676776876977077177213 unmodified lines7867877887897907917927937947957967977987998008018025 unmodified lines80880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684732 unmodified lines# Configuration parameters# a = bTIP_TRY_N = 1 # Show like button tip after 12 triesFREE_TRY_N = 4 # Free phase: first 15 tries without restrictionsSLOW_TRY_N = 6 # Slow phase start: 25 triesSLOW2_TRY_N = 10 # Slow phase start: 32 tries583 unmodified lines'>⏰ Skip Wait - Unlimited Generation</a></div>"""return None, t("error_free_limit_wait", lang).format(wait_minutes_int=wait_minutes_int), gr.update(value=rate_limit_button_html, visible=True)# Handle NSFW detection based on phaseis_nsfw_task = False # Track if this task involves NSFW content5 unmodified linesif nsfw_result.lower() == "nsfw":is_nsfw_task = Trueprint(f"🔍 Input NSFW detected in {current_phase} phase: ❌❌❌ {nsfw_result} - IP: {client_ip} (will blur result)")else:print(f"🔍 Input NSFW check passed: ✅✅✅ {nsfw_result} - IP: {client_ip}")4 unmodified linesresult_url = Nonestatus_message = ""def progress_callback(message):try:65 unmodified lines# Use translated message or defaultlimit_message = error_message if error_message else t("error_free_limit_reached", lang)return None, limit_message, gr.update(value=hf_limit_button_html, visible=True)if result_url:print(f"✅ Processing completed successfully - IP: {client_ip}, result_url: {result_url}, task_uuid: {task_uuid}", flush=True)38 unmodified linesfinal_result = result_urlfinal_message = t("warning_content_review", lang)# Generate NSFW button for blurred content with different URL for restricted countriesif is_restricted or lang in ["hi", "ru", "zh"]:nsfw_url = GOOGLE_GEMINI_URLelse:nsfw_url = 'https://omnicreator.net/#generator'nsfw_action_buttons_html = f"""<div style='text-align: center; margin: 18px 0 10px 0;'><a href='{nsfw_url}' target='_blank' style='13 unmodified linesborder: none;'>🔥 Unlimited Creative Generation</a></div><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;'><div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>🚀 Omni Image Editor 2.0 is live!</div><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);'>Try the Hugging Face Space demo (free)</a><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></div>"""return final_result, final_message, gr.update(value=nsfw_action_buttons_html, visible=True)else:final_result = result_urlfinal_message = t("status_completed_message", lang).format(message=message)5 unmodified linesprint(f"⚠️ Final progress update failed: {e}")# Generate action buttons HTMLaction_buttons_html = ""# For restricted countries, only show like tip (no action buttons)if is_restricted:if show_like_tip:action_buttons_html = """<div style='display: flex; justify-content: center; margin: 15px 0 5px 0; padding: 0px;'><div style='display: inline-flex;align-items: center;justify-content: center;padding: 12px 24px;background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);color: white;text-decoration: none;border-radius: 10px;font-weight: 600;font-size: 14px;text-align: center;max-width: 400px;box-shadow: 0 3px 12px rgba(255, 107, 107, 0.3);border: none;'>👉 Click the ❤️ Like button to unlock more free trial attempts!</div></div>"""return final_result, final_message, gr.update(value=action_buttons_html, visible=True)else:print(f"❌ Processing failed - IP: {client_ip}, error: {message}", flush=True)return None, t("error_processing_failed", lang).format(message=message), gr.update(visible=False)except Exception as e:print(f"❌ Processing exception - IP: {client_ip}, error: {str(e)}")return None, t("error_processing_exception", lang).format(error=str(e)), gr.update(visible=False)finally:# Task finished (success or failure) — clear active marker to allow next submission immediatelyActive_Tasks.pop(client_ip, None)32 unmodified lines33343536373839583 unmodified lines6236246256266276286295 unmodified lines6356366376386396406414 unmodified lines64664764864965065165265 unmodified lines71871972072172272372438 unmodified lines76376476576676776876977077177277377477577677777877978078178278378478578678778878913 unmodified lines8038048058068078088098108115 unmodified lines81781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987032 unmodified lines# Configuration parameters# a = bTIP_TRY_N = 1 # Show like button tip after x triesFREE_TRY_N = 4 # Free phase: first 15 tries without restrictionsSLOW_TRY_N = 6 # Slow phase start: 25 triesSLOW2_TRY_N = 10 # Slow phase start: 32 tries583 unmodified lines'>⏰ Skip Wait - Unlimited Generation</a></div>"""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# Handle NSFW detection based on phaseis_nsfw_task = False # Track if this task involves NSFW content5 unmodified linesif nsfw_result.lower() == "nsfw":is_nsfw_task = Trueuse_as_input_state = gr.update(interactive=False)print(f"🔍 Input NSFW detected in {current_phase} phase: ❌❌❌ {nsfw_result} - IP: {client_ip} (will blur result)")else:print(f"🔍 Input NSFW check passed: ✅✅✅ {nsfw_result} - IP: {client_ip}")4 unmodified linesresult_url = Nonestatus_message = ""use_as_input_state = gr.update(interactive=True)def progress_callback(message):try:65 unmodified lines# Use translated message or defaultlimit_message = error_message if error_message else t("error_free_limit_reached", lang)return None, limit_message, gr.update(value=hf_limit_button_html, visible=True), use_as_input_stateif result_url:print(f"✅ Processing completed successfully - IP: {client_ip}, result_url: {result_url}, task_uuid: {task_uuid}", flush=True)38 unmodified linesfinal_result = result_urlfinal_message = t("warning_content_review", lang)# Disable use-as-input when NSFW content is detecteduse_as_input_state = gr.update(interactive=False)# Generate NSFW button for blurred content with different URL for restricted countriesif is_restricted or lang in ["hi", "ru", "zh"]:nsfw_url = GOOGLE_GEMINI_URLelse:nsfw_url = 'https://omnicreator.net/#generator'banner_html = """<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;'><div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>🚀 Omni Image Editor 2.0 is live!</div><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);'>Try the Hugging Face Space demo (free)</a><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></div>"""nsfw_action_buttons_html = f"""<div style='text-align: center; margin: 18px 0 10px 0;'><a href='{nsfw_url}' target='_blank' style='13 unmodified linesborder: none;'>🔥 Unlimited Creative Generation</a></div>{banner_html}"""return final_result, final_message, gr.update(value=nsfw_action_buttons_html, visible=True), use_as_input_stateelse:final_result = result_urlfinal_message = t("status_completed_message", lang).format(message=message)5 unmodified linesprint(f"⚠️ Final progress update failed: {e}")# Generate action buttons HTMLbanner_html = """<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;'><div style='font-size: 15px; font-weight: 800; color: #1f2a44; display: flex; align-items: center; justify-content: center; gap: 8px;'>🚀 Omni Image Editor 2.0 is live!</div><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);'>Try the Hugging Face Space demo (free)</a><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></div>"""action_buttons_html = ""# 根据 TIP_TRY_N(受限地区从第一次起就触发)展示点赞提示if show_like_tip:action_buttons_html = """<div style='display: flex; justify-content: center; margin: 15px 0 5px 0; padding: 0px;'><div style='display: inline-flex;align-items: center;justify-content: center;padding: 12px 24px;background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);color: white;text-decoration: none;border-radius: 10px;font-weight: 600;font-size: 14px;text-align: center;max-width: 400px;box-shadow: 0 3px 12px rgba(255, 107, 107, 0.3);border: none;'>👉 Click the ❤️ Like button to unlock more free trial attempts!</div></div>"""# Always show the Omni Image Editor 2.0 banner under the result imageaction_buttons_html = f"{action_buttons_html}{banner_html}"return final_result, final_message, gr.update(value=action_buttons_html, visible=True), use_as_input_stateelse:print(f"❌ Processing failed - IP: {client_ip}, error: {message}", flush=True)return None, t("error_processing_failed", lang).format(message=message), gr.update(visible=False), use_as_input_stateexcept Exception as e:print(f"❌ Processing exception - IP: {client_ip}, error: {str(e)}")return None, t("error_processing_exception", lang).format(error=str(e)), gr.update(visible=False), use_as_input_statefinally:# Task finished (success or failure) — clear active marker to allow next submission immediatelyActive_Tasks.pop(client_ip, None)
__lib__/app.py+62-39
__lib__/i18n/ar.pyc
__lib__/i18n/da.pyc
__lib__/i18n/de.pyc
__lib__/i18n/en.pyc
__lib__/i18n/es.pyc
__lib__/i18n/fi.pyc
__lib__/i18n/fr.pyc
__lib__/i18n/he.pyc
__lib__/i18n/hi.pyc
__lib__/i18n/id.pyc
__lib__/i18n/it.pyc
__lib__/i18n/ja.pyc
__lib__/i18n/nl.pyc
__lib__/i18n/no.pyc
__lib__/i18n/pt.pyc
__lib__/i18n/ru.pyc
__lib__/i18n/sv.pyc
__lib__/i18n/tr.pyc
__lib__/i18n/uk.pyc
__lib__/i18n/vi.pyc
__lib__/i18n/zh.pyc