Kingoteam commited on
Commit
5c58b46
·
verified ·
1 Parent(s): 694253b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -1,18 +1,17 @@
1
- # ----- Patch شروع -----
2
- import torchvision.transforms.functional as F
3
- import sys
4
-
5
- # اگر functional_tensor وجود نداشت، خودمون شبیه‌سازی می‌کنیم
6
- sys.modules['torchvision.transforms.functional_tensor'] = F
7
- # ----- Patch پایان -----
8
-
9
  from gfpgan import GFPGANer
 
10
  from PIL import Image
11
  import gradio as gr
12
 
13
- # مدل GFPGAN
 
 
 
 
 
 
14
  restorer = GFPGANer(
15
- model_path=None,
16
  upscale=1,
17
  arch='clean',
18
  channel_multiplier=2,
 
 
 
 
 
 
 
 
 
1
  from gfpgan import GFPGANer
2
+ from huggingface_hub import hf_hub_download
3
  from PIL import Image
4
  import gradio as gr
5
 
6
+ # دانلود خودکار مدل GFPGAN از Hugging Face
7
+ model_path = hf_hub_download(
8
+ repo_id="TencentARC/GFPGAN",
9
+ filename="GFPGANv1.4.pth"
10
+ )
11
+
12
+ # ساخت Restorer با مسیر مدل
13
  restorer = GFPGANer(
14
+ model_path=model_path,
15
  upscale=1,
16
  arch='clean',
17
  channel_multiplier=2,