Yaron Koresh commited on
Commit
8bc2527
·
verified ·
1 Parent(s): a299302

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -5,7 +5,7 @@ import numpy as np
5
  import spaces
6
  import random
7
  import string
8
- from diffusers import StableDiffusionPipeline as DiffusionPipeline
9
  import torch
10
  from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
11
  import requests
@@ -14,7 +14,7 @@ from lxml.html import fromstring
14
  pool = ProcessPoolExecutor(1000)
15
  pool.__enter__()
16
 
17
- model_id = "runwayml/stable-diffusion-v1-5"
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
 
20
  if torch.cuda.is_available():
@@ -61,7 +61,12 @@ def infer(prompt):
61
  name = generate_random_string(12)+".png"
62
  english_prompt = f'TRUE {translate(prompt,"english").upper()}:'
63
  print(f'Final prompt: {english_prompt}')
64
- image = pipe(english_prompt).images[0].save(name)
 
 
 
 
 
65
  return name
66
 
67
  css="""
 
5
  import spaces
6
  import random
7
  import string
8
+ from diffusers import StableDiffusion3Pipeline as DiffusionPipeline
9
  import torch
10
  from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
11
  import requests
 
14
  pool = ProcessPoolExecutor(1000)
15
  pool.__enter__()
16
 
17
+ model_id = "stabilityai/stable-diffusion-3-medium-diffusers"
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
 
20
  if torch.cuda.is_available():
 
61
  name = generate_random_string(12)+".png"
62
  english_prompt = f'TRUE {translate(prompt,"english").upper()}:'
63
  print(f'Final prompt: {english_prompt}')
64
+ image = pipe(
65
+ english_prompt,
66
+ negative_prompt="",
67
+ num_inference_steps=50,
68
+ guidance_scale=9.0
69
+ ).images[0].save(name)
70
  return name
71
 
72
  css="""