zenafey commited on
Commit
34c37ad
1 Parent(s): 39b5fa9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -20,8 +20,7 @@ class Prodia:
20
  }
21
 
22
  def photomaker(self, params):
23
- print(params)
24
- response = self._post(f"{self.base}/faceswap", params)
25
  return response.json()
26
 
27
  def get_job(self, job_id):
@@ -64,16 +63,20 @@ client = Prodia()
64
  def generate_image(upload_images, prompt, negative_prompt, style_preset, steps, cfg_scale, strength, seed, progress=gr.Progress(track_tqdm=True)):
65
  error_if_no_img(prompt)
66
 
67
- job = client.photomaker({
68
  "imageData": [file_to_base64(img) for img in upload_images],
69
  "prompt": prompt,
70
  "negative_prompt": negative_prompt,
71
- "style_preset": style_preset,
72
  "steps": steps,
73
  "cfg_scale": cfg_scale,
74
  "strength": strength,
75
  "seed": seed if seed != 0 else random.randint(1, MAX_SEED)
76
- })
 
 
 
 
 
77
  res = prodia.wait(job)
78
 
79
  if res['status'] == "failed":
 
20
  }
21
 
22
  def photomaker(self, params):
23
+ response = self._post(f"{self.base}/photomaker", params)
 
24
  return response.json()
25
 
26
  def get_job(self, job_id):
 
63
  def generate_image(upload_images, prompt, negative_prompt, style_preset, steps, cfg_scale, strength, seed, progress=gr.Progress(track_tqdm=True)):
64
  error_if_no_img(prompt)
65
 
66
+ params = {
67
  "imageData": [file_to_base64(img) for img in upload_images],
68
  "prompt": prompt,
69
  "negative_prompt": negative_prompt,
 
70
  "steps": steps,
71
  "cfg_scale": cfg_scale,
72
  "strength": strength,
73
  "seed": seed if seed != 0 else random.randint(1, MAX_SEED)
74
+ }
75
+
76
+ if style_preset is not None and style_preset in STYLE_PRESETS:
77
+ params['style_preset'] = style_preset
78
+
79
+ job = client.photomaker(params)
80
  res = prodia.wait(job)
81
 
82
  if res['status'] == "failed":