Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -513,7 +513,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 513 |
with gr.Column():
|
| 514 |
gr.HTML("""<div style="background: linear-gradient(135deg, #f9fafb 0%, #fff 100%);
|
| 515 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 516 |
-
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 8px;"
|
| 517 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Envie o XML exportado do Premiere e a transcrição</p>
|
| 518 |
</div>""")
|
| 519 |
xml_in = gr.File(label="XML da sequência (FCP XML)", file_types=[".xml"])
|
|
@@ -522,23 +522,23 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 522 |
with gr.Column():
|
| 523 |
gr.HTML("""<div style="background: linear-gradient(135deg, rgba(57,255,20,0.08) 0%, rgba(57,255,20,0.02) 100%);
|
| 524 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 525 |
-
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 8px;"
|
| 526 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Ajuste o comportamento do processamento</p>
|
| 527 |
</div>""")
|
| 528 |
use_llm = gr.Checkbox(
|
| 529 |
-
label="
|
| 530 |
value=USE_LLM_DEFAULT and LLM_AVAILABLE,
|
| 531 |
info="Usa IA para escolher os melhores trechos narrativamente"
|
| 532 |
)
|
| 533 |
num_segments = gr.Slider(
|
| 534 |
minimum=2, maximum=10, step=1, value=5,
|
| 535 |
-
label="
|
| 536 |
info="Quantos trechos incluir no vídeo final"
|
| 537 |
)
|
| 538 |
|
| 539 |
-
with gr.Accordion("
|
| 540 |
gr.HTML("""<div style="background: #fffbeb; padding: 12px; border-radius: 10px; border: 1px solid #fde68a; margin-bottom: 12px;">
|
| 541 |
-
<strong style="color: #92400e;"
|
| 542 |
<p style="color: #78350f; font-size: 13px; margin: 6px 0 0;">
|
| 543 |
Se preencher este campo, o app ignora a transcrição e todos os outros parâmetros,
|
| 544 |
cortando EXATAMENTE o que você especificou.
|
|
@@ -552,7 +552,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 552 |
gr.HTML("""
|
| 553 |
<div style="padding: 12px; background: #f9fafb; border-radius: 10px; margin-top: 12px;">
|
| 554 |
<div style="font-weight: 600; margin-bottom: 8px; color: #0a0a0a;">Formatos aceitos:</div>
|
| 555 |
-
<ul style="margin: 0; padding-left: 20px; color: #
|
| 556 |
<li><code>hh:mm:ss:ff - hh:mm:ss:ff</code> (um por linha)</li>
|
| 557 |
<li>Pode separar por vírgula também</li>
|
| 558 |
<li>Exemplo: <code>00:01:30:00 - 00:02:00:15, 00:05:10:00 - 00:06:20:10</code></li>
|
|
@@ -560,35 +560,35 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 560 |
</div>
|
| 561 |
""")
|
| 562 |
|
| 563 |
-
with gr.Accordion("
|
| 564 |
custom_keywords = gr.Textbox(
|
| 565 |
label="Adicione palavras-chave importantes (separadas por vírgula)",
|
| 566 |
placeholder="Exemplo: transformação, resultado, método, estratégia",
|
| 567 |
info="Trechos com essas palavras terão prioridade máxima (peso 3.0) - Só funciona no modo automático"
|
| 568 |
)
|
| 569 |
|
| 570 |
-
with gr.Accordion("
|
| 571 |
gr.HTML("""<p style="color: #6b7280; margin-bottom: 16px;">
|
| 572 |
Ajuste a importância de cada categoria na pontuação heurística (modo automático)</p>""")
|
| 573 |
with gr.Row():
|
| 574 |
-
weight_emotion = gr.Slider(0, 5, value=2.0, step=0.1, label="
|
| 575 |
-
weight_break = gr.Slider(0, 5, value=1.5, step=0.1, label="
|
| 576 |
with gr.Row():
|
| 577 |
-
weight_learn = gr.Slider(0, 5, value=1.2, step=0.1, label="
|
| 578 |
-
weight_viral = gr.Slider(0, 5, value=1.0, step=0.1, label="
|
| 579 |
|
| 580 |
gr.HTML("""<div style="margin: 24px 0; text-align: center;">
|
| 581 |
<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 16px 0;">
|
| 582 |
</div>""")
|
| 583 |
|
| 584 |
-
run_btn = gr.Button("
|
| 585 |
|
| 586 |
gr.HTML("""<div style="margin: 20px 0;">
|
| 587 |
<hr style="border: none; border-top: 1px solid #e5e7eb;">
|
| 588 |
</div>""")
|
| 589 |
|
| 590 |
gr.HTML("""<div style="text-align: center; margin-bottom: 16px;">
|
| 591 |
-
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 4px;"
|
| 592 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Resumo dos cortes e arquivo para download</p>
|
| 593 |
</div>""")
|
| 594 |
|
|
@@ -597,7 +597,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 597 |
resumo_out = gr.Textbox(label="Resumo dos cortes aplicados", lines=15)
|
| 598 |
with gr.Column(scale=1):
|
| 599 |
status_out = gr.Textbox(label="Status", interactive=False)
|
| 600 |
-
file_out = gr.File(label="
|
| 601 |
|
| 602 |
run_btn.click(
|
| 603 |
process_xml_and_transcript,
|
|
@@ -606,7 +606,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 606 |
outputs=[resumo_out, file_out, status_out]
|
| 607 |
)
|
| 608 |
|
| 609 |
-
with gr.Accordion("
|
| 610 |
gr.HTML("""
|
| 611 |
<div style="padding: 16px; background: #f9fafb; border-radius: 12px;">
|
| 612 |
<div style="margin-bottom: 20px;">
|
|
@@ -614,8 +614,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 614 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 8px;">
|
| 615 |
MODO MANUAL
|
| 616 |
</div>
|
| 617 |
-
<h3 style="margin: 8px 0; font-weight: 700; color: #0a0a0a;"
|
| 618 |
-
<ul style="color: #
|
| 619 |
<li>Preencha o campo "Minutagens Manuais" com seus timecodes exatos</li>
|
| 620 |
<li>A transcrição se torna opcional</li>
|
| 621 |
<li>Todos os outros parâmetros são ignorados</li>
|
|
@@ -628,8 +628,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 628 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 8px;">
|
| 629 |
MODO AUTOMÁTICO
|
| 630 |
</div>
|
| 631 |
-
<h3 style="margin: 8px 0; font-weight: 700; color: #0a0a0a;"
|
| 632 |
-
<ul style="color: #
|
| 633 |
<li>Deixe as minutagens manuais vazias</li>
|
| 634 |
<li>Envie a transcrição com timecodes</li>
|
| 635 |
<li>Configure LLM, palavras-chave e pesos conforme desejado</li>
|
|
|
|
| 513 |
with gr.Column():
|
| 514 |
gr.HTML("""<div style="background: linear-gradient(135deg, #f9fafb 0%, #fff 100%);
|
| 515 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 516 |
+
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 8px;">Arquivos de entrada</div>
|
| 517 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Envie o XML exportado do Premiere e a transcrição</p>
|
| 518 |
</div>""")
|
| 519 |
xml_in = gr.File(label="XML da sequência (FCP XML)", file_types=[".xml"])
|
|
|
|
| 522 |
with gr.Column():
|
| 523 |
gr.HTML("""<div style="background: linear-gradient(135deg, rgba(57,255,20,0.08) 0%, rgba(57,255,20,0.02) 100%);
|
| 524 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 525 |
+
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 8px;">Configurações básicas</div>
|
| 526 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Ajuste o comportamento do processamento</p>
|
| 527 |
</div>""")
|
| 528 |
use_llm = gr.Checkbox(
|
| 529 |
+
label="Usar Potência Criativa",
|
| 530 |
value=USE_LLM_DEFAULT and LLM_AVAILABLE,
|
| 531 |
info="Usa IA para escolher os melhores trechos narrativamente"
|
| 532 |
)
|
| 533 |
num_segments = gr.Slider(
|
| 534 |
minimum=2, maximum=10, step=1, value=5,
|
| 535 |
+
label="Número de segmentos (só no modo automático)",
|
| 536 |
info="Quantos trechos incluir no vídeo final"
|
| 537 |
)
|
| 538 |
|
| 539 |
+
with gr.Accordion("MINUTAGENS MANUAIS (Sobrescreve tudo)", open=True):
|
| 540 |
gr.HTML("""<div style="background: #fffbeb; padding: 12px; border-radius: 10px; border: 1px solid #fde68a; margin-bottom: 12px;">
|
| 541 |
+
<strong style="color: #92400e;">Modo de Controle Total</strong>
|
| 542 |
<p style="color: #78350f; font-size: 13px; margin: 6px 0 0;">
|
| 543 |
Se preencher este campo, o app ignora a transcrição e todos os outros parâmetros,
|
| 544 |
cortando EXATAMENTE o que você especificou.
|
|
|
|
| 552 |
gr.HTML("""
|
| 553 |
<div style="padding: 12px; background: #f9fafb; border-radius: 10px; margin-top: 12px;">
|
| 554 |
<div style="font-weight: 600; margin-bottom: 8px; color: #0a0a0a;">Formatos aceitos:</div>
|
| 555 |
+
<ul style="margin: 0; padding-left: 20px; color: #000000; font-size: 13px;">
|
| 556 |
<li><code>hh:mm:ss:ff - hh:mm:ss:ff</code> (um por linha)</li>
|
| 557 |
<li>Pode separar por vírgula também</li>
|
| 558 |
<li>Exemplo: <code>00:01:30:00 - 00:02:00:15, 00:05:10:00 - 00:06:20:10</code></li>
|
|
|
|
| 560 |
</div>
|
| 561 |
""")
|
| 562 |
|
| 563 |
+
with gr.Accordion("Palavras-chave Personalizadas", open=False):
|
| 564 |
custom_keywords = gr.Textbox(
|
| 565 |
label="Adicione palavras-chave importantes (separadas por vírgula)",
|
| 566 |
placeholder="Exemplo: transformação, resultado, método, estratégia",
|
| 567 |
info="Trechos com essas palavras terão prioridade máxima (peso 3.0) - Só funciona no modo automático"
|
| 568 |
)
|
| 569 |
|
| 570 |
+
with gr.Accordion("Ajuste Fino dos Pesos de Pontuação", open=False):
|
| 571 |
gr.HTML("""<p style="color: #6b7280; margin-bottom: 16px;">
|
| 572 |
Ajuste a importância de cada categoria na pontuação heurística (modo automático)</p>""")
|
| 573 |
with gr.Row():
|
| 574 |
+
weight_emotion = gr.Slider(0, 5, value=2.0, step=0.1, label="Emoção")
|
| 575 |
+
weight_break = gr.Slider(0, 5, value=1.5, step=0.1, label="Quebra de expectativa")
|
| 576 |
with gr.Row():
|
| 577 |
+
weight_learn = gr.Slider(0, 5, value=1.2, step=0.1, label="Aprendizado")
|
| 578 |
+
weight_viral = gr.Slider(0, 5, value=1.0, step=0.1, label="Viralização")
|
| 579 |
|
| 580 |
gr.HTML("""<div style="margin: 24px 0; text-align: center;">
|
| 581 |
<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 16px 0;">
|
| 582 |
</div>""")
|
| 583 |
|
| 584 |
+
run_btn = gr.Button("Processar e Gerar XML Editado", variant="primary", size="lg")
|
| 585 |
|
| 586 |
gr.HTML("""<div style="margin: 20px 0;">
|
| 587 |
<hr style="border: none; border-top: 1px solid #e5e7eb;">
|
| 588 |
</div>""")
|
| 589 |
|
| 590 |
gr.HTML("""<div style="text-align: center; margin-bottom: 16px;">
|
| 591 |
+
<div style="font-weight: 700; color: #0a0a0a; margin-bottom: 4px;">Resultados</div>
|
| 592 |
<p style="color: #6b7280; font-size: 14px; margin: 0;">Resumo dos cortes e arquivo para download</p>
|
| 593 |
</div>""")
|
| 594 |
|
|
|
|
| 597 |
resumo_out = gr.Textbox(label="Resumo dos cortes aplicados", lines=15)
|
| 598 |
with gr.Column(scale=1):
|
| 599 |
status_out = gr.Textbox(label="Status", interactive=False)
|
| 600 |
+
file_out = gr.File(label="Download do XML Editado")
|
| 601 |
|
| 602 |
run_btn.click(
|
| 603 |
process_xml_and_transcript,
|
|
|
|
| 606 |
outputs=[resumo_out, file_out, status_out]
|
| 607 |
)
|
| 608 |
|
| 609 |
+
with gr.Accordion("Guia de Uso", open=False):
|
| 610 |
gr.HTML("""
|
| 611 |
<div style="padding: 16px; background: #f9fafb; border-radius: 12px;">
|
| 612 |
<div style="margin-bottom: 20px;">
|
|
|
|
| 614 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 8px;">
|
| 615 |
MODO MANUAL
|
| 616 |
</div>
|
| 617 |
+
<h3 style="margin: 8px 0; font-weight: 700; color: #0a0a0a;">Controle Total</h3>
|
| 618 |
+
<ul style="color: #000000; line-height: 1.65; padding-left: 20px;">
|
| 619 |
<li>Preencha o campo "Minutagens Manuais" com seus timecodes exatos</li>
|
| 620 |
<li>A transcrição se torna opcional</li>
|
| 621 |
<li>Todos os outros parâmetros são ignorados</li>
|
|
|
|
| 628 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 8px;">
|
| 629 |
MODO AUTOMÁTICO
|
| 630 |
</div>
|
| 631 |
+
<h3 style="margin: 8px 0; font-weight: 700; color: #0a0a0a;">Seleção Inteligente</h3>
|
| 632 |
+
<ul style="color: #000000; line-height: 1.65; padding-left: 20px;">
|
| 633 |
<li>Deixe as minutagens manuais vazias</li>
|
| 634 |
<li>Envie a transcrição com timecodes</li>
|
| 635 |
<li>Configure LLM, palavras-chave e pesos conforme desejado</li>
|