dennny123 commited on
Commit
2bce5ed
·
1 Parent(s): 1cb4402

Optimize UI: Fixed heights, side-by-side layout, removed share footer, deleted APPROACH.md

Browse files
Files changed (2) hide show
  1. APPROACH.md +0 -24
  2. app.py +32 -9
APPROACH.md DELETED
@@ -1,24 +0,0 @@
1
- # SynthID Bypass: Headless ComfyUI Implementation
2
-
3
- This application has been transitioned to a **Headless ComfyUI backend** to ensure a 100% exact replication of the original research.
4
-
5
- ## Why this change?
6
- While `diffusers` is a powerful library, the `00quebec/Synthid-Bypass` research relies on a highly specialized stack of technologies:
7
- 1. **Z-Image-Turbo (S3-DiT)**: A specific architecture that differs from standard Stable Diffusion.
8
- 2. **Union ControlNet**: A multi-mode ControlNet that handles structural guidance in a unique way.
9
- 3. **ComfyUI Custom Nodes**: Specifically `Impact Pack` for face restoration and `SeedVR2` for upscaling.
10
-
11
- By running the actual ComfyUI engine in the background of the Hugging Face Space, we guarantee:
12
- - **Identical Model Loading**: Using the exact `.safetensors` files from the research.
13
- - **Identical Logic**: Processing images through the exact same node graph.
14
-
15
- ## Architecture
16
- - **Backend**: Headless ComfyUI server.
17
- - **Frontend**: Gradio UI acting as a client.
18
- - **Environment**: Hugging Face ZeroGPU (with model offloading to CPU when idle).
19
-
20
- ## Deployment Note
21
- The first run on a fresh Hugging Face Space will involve:
22
- 1. Cloning ComfyUI and 6+ custom node repositories.
23
- 2. Downloading approximately 10GB of model weights.
24
- This may lead to a long initial "Building" phase, but ensures the most faithful output possible.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -101,14 +101,37 @@ def remove_watermark(input_image):
101
  finally:
102
  proc.terminate()
103
 
104
- # Simple UI
105
- view = gr.Interface(
106
- fn=remove_watermark,
107
- inputs=gr.Image(type="pil", label="Upload AI Generated Image"),
108
- outputs=gr.Image(type="pil", label="Bypass Result"),
109
- title="SynthID Bypass (Exact ComfyUI Replication)",
110
- description="This Space replicates the research paper 'Synthid-Bypass' using the exact Z-Image-Turbo models. Note: Initial boot takes ~5 minutes to download 10GB of models."
111
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  if __name__ == "__main__":
114
- view.launch()
 
 
101
  finally:
102
  proc.terminate()
103
 
104
+ # Premium UI with Fixed Height and No Share Buttons
105
+ css = """
106
+ #container {
107
+ max-width: 1200px;
108
+ margin: 0 auto;
109
+ }
110
+ .image-preview {
111
+ max-height: 512px !important;
112
+ }
113
+ footer {display: none !important;}
114
+ """
115
+
116
+ with gr.Blocks(css=css, title="SynthID Bypass") as demo:
117
+ with gr.Column(elem_id="container"):
118
+ gr.Markdown("# SynthID Bypass (Exact ComfyUI Replication)")
119
+ gr.Markdown("Replicating 'Synthid-Bypass' with exact Z-Image-Turbo models. Note: Initial boot takes ~5 minutes to download 10GB of models.")
120
+
121
+ with gr.Row():
122
+ with gr.Column():
123
+ input_img = gr.Image(type="pil", label="Input Image", height=512)
124
+ with gr.Column():
125
+ output_img = gr.Image(type="pil", label="Reconstructed Image (Bypass)", height=512, interactive=False)
126
+
127
+ submit_btn = gr.Button("Remove Watermark", variant="primary")
128
+
129
+ submit_btn.click(
130
+ fn=remove_watermark,
131
+ inputs=[input_img],
132
+ outputs=[output_img]
133
+ )
134
 
135
  if __name__ == "__main__":
136
+ # Disable flagging and share to keep UI clean
137
+ demo.launch(show_api=False)