24Sureshkumar commited on
Commit
73242f2
·
verified ·
1 Parent(s): cc35a90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -12,15 +12,14 @@ def load_translation_model():
12
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
13
  return tokenizer, model
14
 
15
- # Load Stable Diffusion model
16
  @st.cache_resource
17
  def load_diffusion_model():
18
  pipe = StableDiffusionPipeline.from_pretrained(
19
  "CompVis/stable-diffusion-v1-4",
20
- torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
21
  )
22
- if torch.cuda.is_available():
23
- pipe = pipe.to("cuda")
24
  return pipe
25
 
26
  # Translate Tamil to English using NLLB
 
12
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
13
  return tokenizer, model
14
 
15
+ # Load Stable Diffusion model for CPU
16
  @st.cache_resource
17
  def load_diffusion_model():
18
  pipe = StableDiffusionPipeline.from_pretrained(
19
  "CompVis/stable-diffusion-v1-4",
20
+ torch_dtype=torch.float32 # Important for CPU
21
  )
22
+ pipe = pipe.to("cpu") # ✅ Force to CPU
 
23
  return pipe
24
 
25
  # Translate Tamil to English using NLLB