Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,14 +38,17 @@ def generate_video_script(title, formality_level, emotional_tone, engagement_lev
|
|
| 38 |
)
|
| 39 |
|
| 40 |
try:
|
| 41 |
-
response = openai.
|
| 42 |
model="gpt-3.5-turbo",
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
temperature=0.7,
|
| 46 |
-
|
| 47 |
)
|
| 48 |
-
script
|
|
|
|
| 49 |
return script
|
| 50 |
except Exception as e:
|
| 51 |
st.error(f"Failed to generate script: {str(e)}")
|
|
|
|
| 38 |
)
|
| 39 |
|
| 40 |
try:
|
| 41 |
+
response = openai.ChatCompletion.create(
|
| 42 |
model="gpt-3.5-turbo",
|
| 43 |
+
messages=[
|
| 44 |
+
{"role": "system", "content": "Generate a script based on the following instructions."},
|
| 45 |
+
{"role": "user", "content": prompt}
|
| 46 |
+
],
|
| 47 |
temperature=0.7,
|
| 48 |
+
max_tokens=1024,
|
| 49 |
)
|
| 50 |
+
# Accessing the generated script from the response
|
| 51 |
+
script = response['choices'][0]['message']['content'].strip()
|
| 52 |
return script
|
| 53 |
except Exception as e:
|
| 54 |
st.error(f"Failed to generate script: {str(e)}")
|