cngsm commited on
Commit
4a15a9d
·
verified ·
1 Parent(s): abfbb4d

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -43
app.py DELETED
@@ -1,43 +0,0 @@
1
-
2
- import gradio as gr
3
- import os
4
- from video_analyzer_keyframes import VideoSceneAnalyzer
5
- import shutil
6
-
7
- def process_video_keyframes(video_file):
8
- video_path = video_file
9
- output_dir = "output"
10
-
11
- if not os.path.exists(video_path):
12
- return "❌ Erro: vídeo não encontrado.", None
13
-
14
- try:
15
- analyzer = VideoSceneAnalyzer(video_path)
16
- if not analyzer.load_video():
17
- return "❌ Erro ao carregar vídeo", None
18
-
19
- analyzer.extract_keyframes()
20
- result_file = analyzer.save_results()
21
- analyzer.cleanup()
22
-
23
- if not os.path.exists(output_dir):
24
- os.makedirs(output_dir)
25
- shutil.copy(result_file, os.path.join(output_dir, os.path.basename(result_file)))
26
-
27
- return f"✅ Análise por quadros-chave concluída! Resultados salvos em: {result_file}", os.path.join(output_dir, os.path.basename(result_file))
28
- except Exception as e:
29
- return f"❌ Erro inesperado: {e}", None
30
-
31
- with gr.Blocks(title="🎬 Veo3 Keyframe Prompt Generator") as demo:
32
- gr.Markdown("## 🎞️ Geração de prompts cinematográficos a partir de quadros-chave do vídeo")
33
-
34
- with gr.Row():
35
- video_input = gr.Video(label="📹 Envie seu vídeo (MP4)")
36
-
37
- submit_btn = gr.Button("🚀 Analisar quadros-chave")
38
- output_text = gr.Textbox(label="📝 Resultado")
39
- output_file = gr.File(label="📄 JSON com prompts", visible=True)
40
-
41
- submit_btn.click(fn=process_video_keyframes, inputs=[video_input], outputs=[output_text, output_file])
42
-
43
- demo.launch()