HAL1993 commited on
Commit
5337bc8
·
verified ·
1 Parent(s): 257570a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -1,16 +1,15 @@
1
  # ----------------------------------------------------------------------
2
  # 0️⃣ Install the exact versions we need (run once at start‑up)
3
  # ----------------------------------------------------------------------
4
- # 1️⃣ Install a nightly torch< 2.9 (as you already did)
5
- # 2️⃣ Upgrade huggingface‑hub to the version required by the Qwen pipeline
6
- # 3️⃣ Install a recent transformers build (needed for Qwen2.5‑VL)
 
7
  import os
8
  os.system(
9
  'pip install --upgrade --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu126 '
10
- '"torch<2.9" '
11
- '"huggingface-hub>=1.0.0rc6" '
12
- '"transformers>=4.40.0" '
13
- 'spaces -q'
14
  )
15
 
16
  # ----------------------------------------------------------------------
@@ -119,7 +118,7 @@ def edit_images(image1, image2, prompt):
119
  prompt_en = translate_albanian_to_english(prompt.strip(), language="en")
120
  prompt_final = prompt_en + QUALITY_PROMPT
121
 
122
- # Ensure we have PIL Images
123
  if not isinstance(image1, Image.Image):
124
  image1 = Image.fromarray(image1)
125
  if not isinstance(image2, Image.Image):
 
1
  # ----------------------------------------------------------------------
2
  # 0️⃣ Install the exact versions we need (run once at start‑up)
3
  # ----------------------------------------------------------------------
4
+ # PyTorch 2.9 (nightly) + matching torchvision/torchaudio
5
+ # transformers ≥ 4.44 (contains Qwen2_5_VLForConditionalGeneration)
6
+ # huggingface‑hub ≥ 1.0.0rc6 (required by the Qwen pipeline)
7
+ # • spaces (already used)
8
  import os
9
  os.system(
10
  'pip install --upgrade --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu126 '
11
+ '"torch==2.9.0" "torchvision==0.24.0" "torchaudio==2.9.0" '
12
+ '"transformers>=4.44" "huggingface-hub>=1.0.0rc6" spaces -q'
 
 
13
  )
14
 
15
  # ----------------------------------------------------------------------
 
118
  prompt_en = translate_albanian_to_english(prompt.strip(), language="en")
119
  prompt_final = prompt_en + QUALITY_PROMPT
120
 
121
+ # Ensure PIL Images
122
  if not isinstance(image1, Image.Image):
123
  image1 = Image.fromarray(image1)
124
  if not isinstance(image2, Image.Image):