ikmalsaid commited on
Commit
ecb4ade
1 Parent(s): 39045c7
Files changed (1) hide show
  1. kalam_data.py +3 -2
kalam_data.py CHANGED
@@ -27,8 +27,8 @@ logging.basicConfig(level=logging.DEBUG)
27
  def expand(expand):
28
  pfix = '(The prompt must intricately describe every part of the image in concrete, objective detail. THINK about what the end goal of the description is, and extrapolate that to what would make satisfying images.)'
29
  head = {'Content-Type': 'application/json'}
30
- body = json.dumps({"topic": f"{expand} {pfix}", "word_count": 40, "writing_mode": "Simple", "story_genre": "Descriptive"})
31
- try: return requests.post(url=os.getenv('gpt4'), headers=head, data=body, timeout=15).json()['story']
32
  except Exception as e: print(f"Expansion error: {e}"); return expand
33
 
34
  def theme_change(a, i: ui.SelectData):
@@ -52,6 +52,7 @@ def stella(expanded, surah, mode):
52
  }
53
 
54
  try:
 
55
  response = requests.post(os.getenv('generate'), headers=key, files=data, timeout=(60, 60))
56
  layer0 = enhance_img(Image.open(BytesIO(response.content)))
57
 
 
27
  def expand(expand):
28
  pfix = '(The prompt must intricately describe every part of the image in concrete, objective detail. THINK about what the end goal of the description is, and extrapolate that to what would make satisfying images.)'
29
  head = {'Content-Type': 'application/json'}
30
+ body = json.dumps({"sentence": f"{expand} {pfix}", "target_word_count": 40})
31
+ try: return requests.post(url=os.getenv('gpt4'), headers=head, data=body, timeout=15).json()['expanded_sentence']
32
  except Exception as e: print(f"Expansion error: {e}"); return expand
33
 
34
  def theme_change(a, i: ui.SelectData):
 
52
  }
53
 
54
  try:
55
+ print(f'Processing -> {expanded}')
56
  response = requests.post(os.getenv('generate'), headers=key, files=data, timeout=(60, 60))
57
  layer0 = enhance_img(Image.open(BytesIO(response.content)))
58