Royir commited on
Commit
3e248d4
1 Parent(s): 43ce98b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -3,6 +3,18 @@ import torch
3
 
4
  from syngen_diffusion_pipeline import SynGenDiffusionPipeline
5
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  model_path = 'CompVis/stable-diffusion-v1-4'
7
  device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
8
  pipe = SynGenDiffusionPipeline.from_pretrained(model_path).to(device)
 
3
 
4
  from syngen_diffusion_pipeline import SynGenDiffusionPipeline
5
 
6
+ import subprocess
7
+
8
+ def install_spacy_model(model_name):
9
+ try:
10
+ subprocess.check_call(["python", "-m", "pip", "install", "spacy"])
11
+ subprocess.check_call(["python", "-m", "spacy", "download", model_name])
12
+ except subprocess.CalledProcessError as e:
13
+ print(f"Error occurred while installing the model: {model_name}")
14
+ print(f"Error details: {str(e)}")
15
+
16
+ install_spacy_model("en_core_web_trf")
17
+
18
  model_path = 'CompVis/stable-diffusion-v1-4'
19
  device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
20
  pipe = SynGenDiffusionPipeline.from_pretrained(model_path).to(device)