Update app.py
Browse files
app.py
CHANGED
@@ -30,21 +30,23 @@ def txt2story(img_text):
|
|
30 |
|
31 |
messages = [
|
32 |
{"role": "system", "content": '''As an experienced short story writer, write story title and then create a meaningful story influenced by provided words.
|
33 |
-
Ensure stories conclude positively within 100 words. Remember the story must end within 100 words''', "temperature":
|
34 |
-
{"role": "user", "content": f"Here is input set of words: {img_text}", "temperature":
|
35 |
]
|
36 |
|
37 |
print("Story...")
|
38 |
chat_completion = client.chat.completions.create(
|
|
|
39 |
messages=messages,
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
print(chat_completion.choices[0].message.content)
|
46 |
return chat_completion.choices[0].message.content
|
47 |
|
|
|
48 |
# Text-to-speech
|
49 |
def txt2speech(text):
|
50 |
print("Initializing text-to-speech conversion...")
|
|
|
30 |
|
31 |
messages = [
|
32 |
{"role": "system", "content": '''As an experienced short story writer, write story title and then create a meaningful story influenced by provided words.
|
33 |
+
Ensure stories conclude positively within 100 words. Remember the story must end within 100 words''', "temperature": temperature},
|
34 |
+
{"role": "user", "content": f"Here is input set of words: {img_text}", "temperature": temperature},
|
35 |
]
|
36 |
|
37 |
print("Story...")
|
38 |
chat_completion = client.chat.completions.create(
|
39 |
+
model="togethercomputer/llama-2-70b-chat",
|
40 |
messages=messages,
|
41 |
+
top_k=top_k,
|
42 |
+
top_p=top_p,
|
43 |
+
temperature=temperature
|
44 |
+
)
|
45 |
|
46 |
print(chat_completion.choices[0].message.content)
|
47 |
return chat_completion.choices[0].message.content
|
48 |
|
49 |
+
|
50 |
# Text-to-speech
|
51 |
def txt2speech(text):
|
52 |
print("Initializing text-to-speech conversion...")
|