Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,7 @@ def img2txt(url):
|
|
17 |
print("Generating text from the image...")
|
18 |
text = captioning_model(url, max_new_tokens=20)[0]["generated_text"]
|
19 |
|
|
|
20 |
print("Text generated successfully.")
|
21 |
return text
|
22 |
|
@@ -38,7 +39,7 @@ def txt2story(img_text):
|
|
38 |
messages = [
|
39 |
{"role": "system", "content": '''You are an expert short story writer who specialises
|
40 |
in writing stories on input set of words.''', "temperature": 0.8},
|
41 |
-
{"role": "user", "content": "
|
42 |
]
|
43 |
|
44 |
print("Generating story completion using the AI model...")
|
@@ -49,6 +50,7 @@ def txt2story(img_text):
|
|
49 |
|
50 |
print("Story generated successfully.")
|
51 |
return chat_completion.choices[0].message.content
|
|
|
52 |
|
53 |
|
54 |
# Text-to-speech
|
|
|
17 |
print("Generating text from the image...")
|
18 |
text = captioning_model(url, max_new_tokens=20)[0]["generated_text"]
|
19 |
|
20 |
+
print(text)
|
21 |
print("Text generated successfully.")
|
22 |
return text
|
23 |
|
|
|
39 |
messages = [
|
40 |
{"role": "system", "content": '''You are an expert short story writer who specialises
|
41 |
in writing stories on input set of words.''', "temperature": 0.8},
|
42 |
+
{"role": "user", "content": "Here is input set of words: {img_text}", "temperature": 1},
|
43 |
]
|
44 |
|
45 |
print("Generating story completion using the AI model...")
|
|
|
50 |
|
51 |
print("Story generated successfully.")
|
52 |
return chat_completion.choices[0].message.content
|
53 |
+
print(chat_completion.choices[0].message.content)
|
54 |
|
55 |
|
56 |
# Text-to-speech
|