gokaygokay commited on
Commit
10e5a04
·
1 Parent(s): fef529c

Fix Real-ESRGAN runtime installation

Browse files
Files changed (2) hide show
  1. app.py +17 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -15,8 +15,23 @@ from diffusers import (
15
  UniPCMultistepScheduler,
16
  )
17
 
 
18
  import subprocess
19
- subprocess.run("pip install git+https://github.com/inference-sh/Real-ESRGAN.git --no-deps", shell=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  from diffusers.models.attention_processor import AttnProcessor2_0
22
  import gradio as gr
@@ -333,4 +348,4 @@ with gr.Blocks(theme='bethecloud/storj_theme') as demo:
333
  outputs=[output_gallery, seed_used, full_positive_prompt_used, full_negative_prompt_used]
334
  )
335
 
336
- demo.launch(debug=True)
 
15
  UniPCMultistepScheduler,
16
  )
17
 
18
+ import importlib.util
19
  import subprocess
20
+ import sys
21
+
22
+ if importlib.util.find_spec("RealESRGAN") is None:
23
+ subprocess.run(
24
+ [
25
+ sys.executable,
26
+ "-m",
27
+ "pip",
28
+ "install",
29
+ "git+https://github.com/inference-sh/Real-ESRGAN.git",
30
+ "--no-deps",
31
+ "--no-build-isolation",
32
+ ],
33
+ check=True,
34
+ )
35
 
36
  from diffusers.models.attention_processor import AttnProcessor2_0
37
  import gradio as gr
 
348
  outputs=[output_gallery, seed_used, full_positive_prompt_used, full_negative_prompt_used]
349
  )
350
 
351
+ demo.launch(debug=True)
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  torch
 
2
  accelerate==0.27.2
3
  gradio
4
  invisible-watermark==0.2.0
@@ -13,4 +14,4 @@ sentencepiece
13
  transformers==4.49.0
14
  einops
15
  diffusers
16
- pydantic==2.10.6
 
1
  torch
2
+ setuptools<81
3
  accelerate==0.27.2
4
  gradio
5
  invisible-watermark==0.2.0
 
14
  transformers==4.49.0
15
  einops
16
  diffusers
17
+ pydantic==2.10.6