simonlee-cb commited on
Commit
0a521a6
·
1 Parent(s): 5d9354b

fix: use post for request with body

Browse files
Files changed (1) hide show
  1. internal/api.py +3 -3
internal/api.py CHANGED
@@ -21,7 +21,7 @@ class APIClient():
21
  def suggest_templates(self, prompt, captions):
22
  print(f"GET /api/templates with prompt: {prompt} and captions: {captions}")
23
  url = self.url_with_path("/api/templates")
24
- response = requests.get(url, json={'prompt': prompt, 'captions': captions})
25
  templates = response.json().get('result', [])
26
  template_image_urls = [template.get('image_medium') for template in templates]
27
  return template_image_urls
@@ -29,7 +29,7 @@ class APIClient():
29
  def suggest_stickers(self, prompt, captions):
30
  print(f"GET /api/stickers with prompt: {prompt} and captions: {captions}")
31
  url = self.url_with_path("/api/stickers")
32
- response = requests.get(url, json={'prompt': prompt, 'captions': captions})
33
  stickers = response.json().get('result', [])
34
  sticker_image_urls = [sticker.get('image_url') for sticker in stickers]
35
  return sticker_image_urls
@@ -38,5 +38,5 @@ class APIClient():
38
  url = self.url_with_path("/api/analyze_prompt")
39
  image_urls = [image.get('image_url') for image in images]
40
 
41
- response = requests.get(url, json={'prompt': prompt, 'image_urls': image_urls})
42
  return response.json()
 
21
  def suggest_templates(self, prompt, captions):
22
  print(f"GET /api/templates with prompt: {prompt} and captions: {captions}")
23
  url = self.url_with_path("/api/templates")
24
+ response = requests.post(url, json={'prompt': prompt, 'captions': captions})
25
  templates = response.json().get('result', [])
26
  template_image_urls = [template.get('image_medium') for template in templates]
27
  return template_image_urls
 
29
  def suggest_stickers(self, prompt, captions):
30
  print(f"GET /api/stickers with prompt: {prompt} and captions: {captions}")
31
  url = self.url_with_path("/api/stickers")
32
+ response = requests.post(url, json={'prompt': prompt, 'captions': captions})
33
  stickers = response.json().get('result', [])
34
  sticker_image_urls = [sticker.get('image_url') for sticker in stickers]
35
  return sticker_image_urls
 
38
  url = self.url_with_path("/api/analyze_prompt")
39
  image_urls = [image.get('image_url') for image in images]
40
 
41
+ response = requests.post(url, json={'prompt': prompt, 'image_urls': image_urls})
42
  return response.json()