Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from langchain import PromptTemplate
|
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.llms import OpenAI
|
7 |
|
8 |
-
openai_api_key = os.environ("OPENAI_API_KEY")
|
9 |
|
10 |
llm = OpenAI(temperature=0.9)
|
11 |
|
@@ -20,19 +20,6 @@ def generate_story(text):
|
|
20 |
story = LLMChain(llm=llm, prompt=prompt)
|
21 |
return story.run(text=text)
|
22 |
|
23 |
-
def generate_audio(text, voice):
|
24 |
-
"""Convert the generated story to audio using the Eleven Labs API."""
|
25 |
-
audio = generate(text=text, voice=voice, api_key=eleven_api_key)
|
26 |
-
return audio
|
27 |
-
|
28 |
-
def generate_images(story_text):
|
29 |
-
"""Generate images using the story text using the Replicate API."""
|
30 |
-
output = replicate.run(
|
31 |
-
"stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf",
|
32 |
-
input={"prompt": story_text}
|
33 |
-
)
|
34 |
-
return output
|
35 |
-
|
36 |
def app(text):
|
37 |
story = generate_story(text)
|
38 |
return story
|
|
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.llms import OpenAI
|
7 |
|
8 |
+
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
9 |
|
10 |
llm = OpenAI(temperature=0.9)
|
11 |
|
|
|
20 |
story = LLMChain(llm=llm, prompt=prompt)
|
21 |
return story.run(text=text)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def app(text):
|
24 |
story = generate_story(text)
|
25 |
return story
|