Spaces:
Runtime error
Runtime error
import gradio as gr | |
import openai | |
def generate_scene_description(api_key, theme, scene_number): | |
openai.api_key = api_key | |
intro = f"Generate a structured scene description for a video on the theme \"{theme}\":\n\n" | |
scene = f"Scene #{scene_number}\n" | |
narrator_voice = "Narrator's voice: \n" | |
video_prompt = "Video prompt: \n" | |
voice_over = "Voice over: \n" | |
music_style = "Music style: \n" | |
prompt = intro + scene + narrator_voice + video_prompt + voice_over + music_style | |
response = openai.Completion.create( | |
engine="text-davinci-003", | |
prompt=prompt, | |
max_tokens=250 | |
) | |
return response.choices[0].text.strip() | |
iface.launch() | |