PSaiml commited on
Commit
e194658
1 Parent(s): 853b995

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -20,8 +20,10 @@ is_gpu_busy = False
20
 
21
  def safe_sd(prompt, n_samples, steps, scale, seed, mode):
22
  url = os.getenv('BACKEND_URL_SAFE_NEW')
 
 
23
  res = requests.post(url, json={
24
- "model": "together/universal-sd",
25
  "prompt": prompt,
26
  "n": n_samples,
27
  "mode": mode,
@@ -29,7 +31,8 @@ def safe_sd(prompt, n_samples, steps, scale, seed, mode):
29
  "seed": seed,
30
  "guidance_scale": scale,
31
  }, headers={
32
- "User-Agent": "hfdemo"
 
33
  })
34
  return res
35
 
@@ -54,7 +57,7 @@ def infer(prompt, n_samples, steps, scale, seed):
54
  im = Image.open(BytesIO(base64.b64decode(image['image_base64'])))
55
  images.append(im)
56
 
57
- response = safe_sd(prompt, int(n_samples), max(50,int(steps)), scale, seed, mode="text2img")
58
 
59
  data = json.load(BytesIO(response.content))
60
  if 'output' not in data:
 
20
 
21
  def safe_sd(prompt, n_samples, steps, scale, seed, mode):
22
  url = os.getenv('BACKEND_URL_SAFE_NEW')
23
+ token = os.getenv('BACKEND_TOKEN')
24
+ user = os.getenv('BACKEND_USER')
25
  res = requests.post(url, json={
26
+ "model": "togethercomputer/UniversalSD",
27
  "prompt": prompt,
28
  "n": n_samples,
29
  "mode": mode,
 
31
  "seed": seed,
32
  "guidance_scale": scale,
33
  }, headers={
34
+ "Authorization": token
35
+ "User-Agent": user
36
  })
37
  return res
38
 
 
57
  im = Image.open(BytesIO(base64.b64decode(image['image_base64'])))
58
  images.append(im)
59
 
60
+ response = safe_sd(prompt, int(n_samples), max(50,int(steps)), scale, seed, mode="safe_text2img")
61
 
62
  data = json.load(BytesIO(response.content))
63
  if 'output' not in data: