File size: 799 Bytes
ff1f5a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import json
import requests
from prompts import emotion_prompts, story_prompts
url = "http://0.0.0.0:6002/gentext"
languages = ["en", "es"] # en, es
emotions = ["anxiety", "sadness", "anger"]
# for language in languages:
# for emotion in emotions:
# prompt = emotion_prompts[emotion][language]
# response = requests.post(url, json={"text": prompt})
# with open(f'preloaded_texts/text_{emotion}_{language}.json', 'w') as f:
# json.dump(response.json(), f , indent=2, ensure_ascii=False)
for language in languages:
prompt = story_prompts[language]
response = requests.post(url, json={"text": prompt})
with open(f"preloaded_texts/text_story_{language}.json", "w") as f:
json.dump(response.json(), f, indent=2, ensure_ascii=False)
|