Spaces:
Sleeping
Sleeping
Commit
·
f689c94
1
Parent(s):
f31b8c7
Initial
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ import os
|
|
4 |
|
5 |
client = OpenAI(api_key=os.environ['OPENAI_API_KEY'])
|
6 |
|
|
|
7 |
def generate_story(topic):
|
8 |
prompt = f"Write a short, creative, and fun children's story about the following topic:\n\nTopic: {topic}\n\nStory:"
|
9 |
response = client.chat.completions.create(
|
10 |
-
model="gpt-
|
11 |
messages=[{"role": "user", "content": prompt}],
|
12 |
max_tokens=500,
|
13 |
temperature=0.8
|
@@ -15,6 +16,7 @@ def generate_story(topic):
|
|
15 |
story = response.choices[0].message.content.strip()
|
16 |
return story
|
17 |
|
|
|
18 |
iface = gr.Interface(
|
19 |
fn=generate_story,
|
20 |
inputs=gr.Textbox(label="Story Topic", placeholder="E.g., Adventures of a brave rabbit..."),
|
|
|
4 |
|
5 |
client = OpenAI(api_key=os.environ['OPENAI_API_KEY'])
|
6 |
|
7 |
+
|
8 |
def generate_story(topic):
|
9 |
prompt = f"Write a short, creative, and fun children's story about the following topic:\n\nTopic: {topic}\n\nStory:"
|
10 |
response = client.chat.completions.create(
|
11 |
+
model="gpt-4.5",
|
12 |
messages=[{"role": "user", "content": prompt}],
|
13 |
max_tokens=500,
|
14 |
temperature=0.8
|
|
|
16 |
story = response.choices[0].message.content.strip()
|
17 |
return story
|
18 |
|
19 |
+
|
20 |
iface = gr.Interface(
|
21 |
fn=generate_story,
|
22 |
inputs=gr.Textbox(label="Story Topic", placeholder="E.g., Adventures of a brave rabbit..."),
|