Spaces:
Running on Zero
Running on Zero
Upload 6 files
Browse files- README.md +9 -8
- app.py +41 -0
- backend/app.cpython-310-x86_64-linux-gnu.so +0 -0
- packages.txt +1 -0
- requirements.txt +12 -0
README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
---
|
| 2 |
title: Qwen Image Edit NSFW
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 6.
|
| 8 |
-
python_version: '3.12'
|
| 9 |
app_file: app.py
|
| 10 |
-
pinned:
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Qwen Image Edit NSFW
|
| 3 |
+
emoji: 🖼
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.1.0
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
+
pinned: true
|
| 10 |
+
disclaimer: nudity
|
| 11 |
+
tags:
|
| 12 |
+
- nsfw
|
| 13 |
+
short_description: Uncensored Image editing tool Edit image with a text prompt
|
| 14 |
+
---
|
app.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Bootstrap loader for directly uploaded compiled ZeroGPU Space.
|
| 3 |
+
Loads and executes the compiled `backend/app.so` binary within this process.
|
| 4 |
+
"""
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
import importlib.util
|
| 8 |
+
|
| 9 |
+
# Path to the subfolder where your compiled app.so lives
|
| 10 |
+
BACKEND_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "backend")
|
| 11 |
+
|
| 12 |
+
if not os.path.isdir(BACKEND_DIR):
|
| 13 |
+
raise SystemExit(
|
| 14 |
+
f"Error: '{BACKEND_DIR}' directory not found. "
|
| 15 |
+
"Please make sure you uploaded the 'backend' folder containing your 'app.so'."
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# 1. Insert backend directory to the top of Python's search path & switch working directory
|
| 19 |
+
sys.path.insert(0, BACKEND_DIR)
|
| 20 |
+
os.chdir(BACKEND_DIR)
|
| 21 |
+
|
| 22 |
+
print("[bootstrap] searching for compiled app binary in backend/ ...")
|
| 23 |
+
|
| 24 |
+
# 2. Look for the compiled module (e.g. app.so or app.cpython-xxx.so)
|
| 25 |
+
spec = importlib.util.find_spec("app")
|
| 26 |
+
if spec is None:
|
| 27 |
+
raise ImportError(
|
| 28 |
+
"Could not find the compiled 'app' binary module inside the backend folder.\n"
|
| 29 |
+
"Ensure the file is compiled for Linux x86_64 and matches the Space's Python version."
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# 3. Load the binary module dynamically
|
| 33 |
+
compiled_app = importlib.util.module_from_spec(spec)
|
| 34 |
+
|
| 35 |
+
# 4. Simulate the "__main__" environment (crucial for ZeroGPU decorators and imports)
|
| 36 |
+
compiled_app.__name__ = "__main__"
|
| 37 |
+
|
| 38 |
+
print("[bootstrap] launching compiled app ...")
|
| 39 |
+
|
| 40 |
+
# 5. Execute the binary in the current process space
|
| 41 |
+
spec.loader.exec_module(compiled_app)
|
backend/app.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (87.2 kB). View file
|
|
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
git
|
requirements.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
git+https://github.com/huggingface/diffusers.git
|
| 2 |
+
|
| 3 |
+
transformers
|
| 4 |
+
accelerate
|
| 5 |
+
safetensors
|
| 6 |
+
sentencepiece
|
| 7 |
+
dashscope
|
| 8 |
+
torchvision
|
| 9 |
+
peft
|
| 10 |
+
torchao==0.11.0
|
| 11 |
+
requests
|
| 12 |
+
spaces
|