Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ def img2txt(url):
|
|
| 21 |
return text
|
| 22 |
|
| 23 |
# Text-to-story
|
| 24 |
-
def txt2story(img_text):
|
| 25 |
print("Initializing client...")
|
| 26 |
client = openai.OpenAI(
|
| 27 |
api_key=os.environ["TOGETHER_API_KEY"],
|
|
@@ -85,7 +85,7 @@ def main():
|
|
| 85 |
# Initiates AI processing and story generation
|
| 86 |
with st.spinner("## 🤖 AI is at Work! "):
|
| 87 |
scenario = img2txt("uploaded_image.jpg") # Extracts text from the image
|
| 88 |
-
story = txt2story(scenario) # Generates a story based on the image text
|
| 89 |
txt2speech(story) # Converts the story to audio
|
| 90 |
|
| 91 |
st.markdown("---")
|
|
|
|
| 21 |
return text
|
| 22 |
|
| 23 |
# Text-to-story
|
| 24 |
+
def txt2story(img_text, top_k, top_p, temperature):
|
| 25 |
print("Initializing client...")
|
| 26 |
client = openai.OpenAI(
|
| 27 |
api_key=os.environ["TOGETHER_API_KEY"],
|
|
|
|
| 85 |
# Initiates AI processing and story generation
|
| 86 |
with st.spinner("## 🤖 AI is at Work! "):
|
| 87 |
scenario = img2txt("uploaded_image.jpg") # Extracts text from the image
|
| 88 |
+
story = txt2story(scenario, top_k, top_p, temperature) # Generates a story based on the image text, LLM params
|
| 89 |
txt2speech(story) # Converts the story to audio
|
| 90 |
|
| 91 |
st.markdown("---")
|