jonatei commited on
Commit
6db36cd
Β·
1 Parent(s): 41f94a2

Fix: skip Moebius requirements.txt, curate deps, request T4 GPU

Browse files
Files changed (3) hide show
  1. README.md +1 -0
  2. app.py +6 -12
  3. requirements.txt +18 -1
README.md CHANGED
@@ -8,4 +8,5 @@ sdk_version: 5.33.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
11
  ---
 
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
+ hardware: t4-small
12
  ---
app.py CHANGED
@@ -14,13 +14,7 @@ if not os.path.exists(MOEBIUS_DIR):
14
  os.chdir(MOEBIUS_DIR)
15
  sys.path.insert(0, MOEBIUS_DIR)
16
 
17
- # ── 2. Install Moebius dependencies ─────────────────────────────────────────
18
- subprocess.run(
19
- [sys.executable, "-m", "pip", "install", "-q", "-r", "requirements.txt"],
20
- check=True,
21
- )
22
-
23
- # ── 3. Download weights ──────────────────────────────────────────────────────
24
  from huggingface_hub import hf_hub_download, snapshot_download
25
 
26
  MOEBIUS_WEIGHT = "weight/Moebius/pretrained/diffusion_pytorch_model.bin"
@@ -41,7 +35,7 @@ if not os.path.exists(os.path.join(VAE_DIR, "config.json")):
41
  ignore_patterns=["*.msgpack", "*.h5", "flax_model*"],
42
  )
43
 
44
- # ── 4. Build pipeline ────────────────────────────────────────────────────────
45
  import torch
46
  from types import SimpleNamespace
47
  from infer.utils import build_pipeline
@@ -55,7 +49,7 @@ args = SimpleNamespace(
55
  )
56
  pipeline = build_pipeline(args)
57
 
58
- # ── 5. Gradio UI ─────────────────────────────────────────────────────────────
59
  import gradio as gr
60
  from PIL import Image
61
  import numpy as np
@@ -92,9 +86,9 @@ with gr.Blocks(title="Moebius Object Removal") as demo:
92
  brush=gr.Brush(colors=["#FFFFFF"], color_mode="fixed"),
93
  )
94
  with gr.Accordion("Advanced", open=False):
95
- image_size = gr.Slider(256, 1024, value=512, step=64, label="Image size")
96
- num_steps = gr.Slider(5, 50, value=20, step=1, label="Diffusion steps")
97
- guidance_scale = gr.Slider(1.0, 10.0, value=4.5, step=0.5, label="Guidance scale")
98
  btn = gr.Button("Remove", variant="primary")
99
  with gr.Column():
100
  output = gr.Image(label="Result")
 
14
  os.chdir(MOEBIUS_DIR)
15
  sys.path.insert(0, MOEBIUS_DIR)
16
 
17
+ # ── 2. Download weights ──────────────────────────────────────────────────────
 
 
 
 
 
 
18
  from huggingface_hub import hf_hub_download, snapshot_download
19
 
20
  MOEBIUS_WEIGHT = "weight/Moebius/pretrained/diffusion_pytorch_model.bin"
 
35
  ignore_patterns=["*.msgpack", "*.h5", "flax_model*"],
36
  )
37
 
38
+ # ── 3. Build pipeline ────────────────────────────────────────────────────────
39
  import torch
40
  from types import SimpleNamespace
41
  from infer.utils import build_pipeline
 
49
  )
50
  pipeline = build_pipeline(args)
51
 
52
+ # ── 4. Gradio UI ─────────────────────────────────────────────────────────────
53
  import gradio as gr
54
  from PIL import Image
55
  import numpy as np
 
86
  brush=gr.Brush(colors=["#FFFFFF"], color_mode="fixed"),
87
  )
88
  with gr.Accordion("Advanced", open=False):
89
+ image_size = gr.Slider(256, 1024, value=512, step=64, label="Image size")
90
+ num_steps = gr.Slider(5, 50, value=20, step=1, label="Diffusion steps")
91
+ guidance_scale = gr.Slider(1.0, 10.0, value=4.5, step=0.5, label="Guidance scale")
92
  btn = gr.Button("Remove", variant="primary")
93
  with gr.Column():
94
  output = gr.Image(label="Result")
requirements.txt CHANGED
@@ -1,2 +1,19 @@
1
- huggingface_hub
 
 
 
 
 
2
  Pillow
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ torch
2
+ torchvision
3
+ diffusers>=0.30
4
+ transformers
5
+ accelerate
6
+ safetensors
7
  Pillow
8
+ numpy
9
+ opencv-python-headless
10
+ pyyaml
11
+ omegaconf
12
+ timm
13
+ tqdm
14
+ toml
15
+ orjson
16
+ pandas
17
+ scipy
18
+ huggingface_hub
19
+ flash-linear-attention