File size: 704 Bytes
e3ab9bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()