PatrickSchrML commited on
Commit
c6ef2b9
·
1 Parent(s): 41ea60b

changed to default

Browse files
Files changed (1) hide show
  1. app.py +3 -23
app.py CHANGED
@@ -24,23 +24,9 @@ def infer(prompt, n_samples, steps, scale, seed):
24
  # generator = torch.Generator(device=device).manual_seed(seed)
25
  # print("Is GPU busy? ", is_gpu_busy)
26
  images = []
27
- # if(not is_gpu_busy):
28
- # is_gpu_busy = True
29
- # images_list = pipe(
30
- # [prompt] * samples,
31
- # num_inference_steps=steps,
32
- # guidance_scale=scale,
33
- # generator=generator,
34
- # )
35
- # is_gpu_busy = False
36
- # safe_image = Image.open(r"unsafe.png")
37
- # for i, image in enumerate(images_list["sample"]):
38
- # if(images_list["nsfw_content_detected"][i]):
39
- # images.append(safe_image)
40
- # else:
41
- # images.append(image)
42
- # else:
43
- url = os.getenv('BACKEND_URL')
44
  response = requests.get(url.format(prompt, int(n_samples), max(50,int(steps)), f'{scale:.1f}', int(seed)))
45
  #response = requests.get(url.format('a%20naked%20girl', 2, 50, 7.5, 2))
46
  data = json.load(BytesIO(response.content))
@@ -51,12 +37,6 @@ def infer(prompt, n_samples, steps, scale, seed):
51
  im = Image.open(BytesIO(base64.b64decode(image['image_base64'])))
52
  images.append(im)
53
 
54
- # payload = {'prompt': prompt}
55
- # images_request = requests.post(url, json=payload)
56
- # for image in images_request.json()["output"]['choices']:
57
- # image_b64 = (f"data:image/jpeg;base64,{image['image_base64']}")
58
- # images.append(image_b64)
59
-
60
  return images
61
 
62
 
 
24
  # generator = torch.Generator(device=device).manual_seed(seed)
25
  # print("Is GPU busy? ", is_gpu_busy)
26
  images = []
27
+ images_default = []
28
+
29
+ url = os.getenv('BACKEND_URL_DEFAULT')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  response = requests.get(url.format(prompt, int(n_samples), max(50,int(steps)), f'{scale:.1f}', int(seed)))
31
  #response = requests.get(url.format('a%20naked%20girl', 2, 50, 7.5, 2))
32
  data = json.load(BytesIO(response.content))
 
37
  im = Image.open(BytesIO(base64.b64decode(image['image_base64'])))
38
  images.append(im)
39
 
 
 
 
 
 
 
40
  return images
41
 
42