Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import openai
|
| 3 |
+
|
| 4 |
+
def generate_scene_description(api_key, theme, scene_number):
|
| 5 |
+
openai.api_key = api_key
|
| 6 |
+
intro = f"Generate a structured scene description for a video on the theme \"{theme}\":\n\n"
|
| 7 |
+
scene = f"Scene #{scene_number}\n"
|
| 8 |
+
narrator_voice = "Narrator's voice: \n"
|
| 9 |
+
video_prompt = "Video prompt: \n"
|
| 10 |
+
voice_over = "Voice over: \n"
|
| 11 |
+
music_style = "Music style: \n"
|
| 12 |
+
|
| 13 |
+
prompt = intro + scene + narrator_voice + video_prompt + voice_over + music_style
|
| 14 |
+
|
| 15 |
+
response = openai.Completion.create(
|
| 16 |
+
engine="text-davinci-003",
|
| 17 |
+
prompt=prompt,
|
| 18 |
+
max_tokens=250
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
return response.choices[0].text.strip()
|
| 22 |
+
|
| 23 |
+
iface.launch()
|