Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -570,7 +570,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 570 |
with gr.Column():
|
| 571 |
gr.HTML("""<div style="background: linear-gradient(135deg, #f9fafb 0%, #fff 100%);
|
| 572 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 573 |
-
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 8px;">
|
| 574 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Envie o XML exportado do Premiere e a transcrição</p>
|
| 575 |
</div>""")
|
| 576 |
xml_in = gr.File(label="XML da sequência (FCP XML)", file_types=[".xml"])
|
|
@@ -579,11 +579,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 579 |
with gr.Column():
|
| 580 |
gr.HTML("""<div style="background: linear-gradient(135deg, rgba(57,255,20,0.08) 0%, rgba(57,255,20,0.02) 100%);
|
| 581 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 582 |
-
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 8px;">
|
| 583 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Ajuste o comportamento do processamento</p>
|
| 584 |
</div>""")
|
| 585 |
use_llm = gr.Checkbox(
|
| 586 |
-
label="
|
| 587 |
value=USE_LLM_DEFAULT and LLM_AVAILABLE,
|
| 588 |
info="Usa IA para escolher os melhores trechos narrativamente"
|
| 589 |
)
|
|
@@ -593,10 +593,10 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 593 |
info="Quantos trechos incluir no vídeo final"
|
| 594 |
)
|
| 595 |
|
| 596 |
-
with gr.Accordion("
|
| 597 |
gr.HTML("""<div style="background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
|
| 598 |
padding: 14px; border-radius: 12px; border: 1px solid #93c5fd; margin-bottom: 12px;">
|
| 599 |
-
<strong style="color: #1e3a8a;">
|
| 600 |
<p style="color: #1e40af; font-size: 13px; margin: 6px 0 0; line-height: 1.6;">
|
| 601 |
Descreva o que você quer em texto simples. A IA vai interpretar e selecionar os trechos certos.
|
| 602 |
<br><strong>Prioridade:</strong> Se preencher este campo, ele tem preferência sobre palavras-chave e pesos.
|
|
@@ -616,7 +616,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 616 |
)
|
| 617 |
gr.HTML("""
|
| 618 |
<div style="padding: 12px; background: #f0f9ff; border-radius: 10px; margin-top: 12px; border: 1px solid #bae6fd;">
|
| 619 |
-
<div style="font-weight: 600; margin-bottom: 8px; color: #0c4a6e;">
|
| 620 |
<ul style="margin: 0; padding-left: 20px; color: #0c4a6e; font-size: 13px; line-height: 1.7;">
|
| 621 |
<li>A IA lê toda a transcrição com timecodes</li>
|
| 622 |
<li>Interpreta suas instruções em português natural</li>
|
|
@@ -626,9 +626,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 626 |
</div>
|
| 627 |
""")
|
| 628 |
|
| 629 |
-
with gr.Accordion("
|
| 630 |
gr.HTML("""<div style="background: #fffbeb; padding: 12px; border-radius: 10px; border: 1px solid #fde68a; margin-bottom: 12px;">
|
| 631 |
-
<strong style="color: #92400e;">
|
| 632 |
<p style="color: #78350f; font-size: 13px; margin: 6px 0 0;">
|
| 633 |
Se preencher este campo, o app ignora TUDO (transcrição, IA, instruções, etc)
|
| 634 |
e corta EXATAMENTE o que você especificou.
|
|
@@ -650,35 +650,35 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 650 |
</div>
|
| 651 |
""")
|
| 652 |
|
| 653 |
-
with gr.Accordion("
|
| 654 |
custom_keywords = gr.Textbox(
|
| 655 |
label="Adicione palavras-chave importantes (separadas por vírgula)",
|
| 656 |
placeholder="Exemplo: transformação, resultado, método, estratégia",
|
| 657 |
info="Trechos com essas palavras terão prioridade máxima (peso 3.0) - Só funciona no modo automático"
|
| 658 |
)
|
| 659 |
|
| 660 |
-
with gr.Accordion("
|
| 661 |
gr.HTML("""<p style="color: #4b5563; margin-bottom: 16px;">
|
| 662 |
Ajuste a importância de cada categoria na pontuação heurística (modo automático)</p>""")
|
| 663 |
with gr.Row():
|
| 664 |
-
weight_emotion = gr.Slider(0, 5, value=2.0, step=0.1, label="
|
| 665 |
-
weight_break = gr.Slider(0, 5, value=1.5, step=0.1, label="
|
| 666 |
with gr.Row():
|
| 667 |
-
weight_learn = gr.Slider(0, 5, value=1.2, step=0.1, label="
|
| 668 |
-
weight_viral = gr.Slider(0, 5, value=1.0, step=0.1, label="
|
| 669 |
|
| 670 |
gr.HTML("""<div style="margin: 24px 0; text-align: center;">
|
| 671 |
<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 16px 0;">
|
| 672 |
</div>""")
|
| 673 |
|
| 674 |
-
run_btn = gr.Button("
|
| 675 |
|
| 676 |
gr.HTML("""<div style="margin: 20px 0;">
|
| 677 |
<hr style="border: none; border-top: 1px solid #e5e7eb;">
|
| 678 |
</div>""")
|
| 679 |
|
| 680 |
gr.HTML("""<div style="text-align: center; margin-bottom: 16px;">
|
| 681 |
-
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 4px;">
|
| 682 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Resumo dos cortes e arquivo para download</p>
|
| 683 |
</div>""")
|
| 684 |
|
|
@@ -696,13 +696,13 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 696 |
outputs=[resumo_out, file_out, status_out]
|
| 697 |
)
|
| 698 |
|
| 699 |
-
with gr.Accordion("
|
| 700 |
gr.HTML("""
|
| 701 |
<div style="padding: 16px; background: #f9fafb; border-radius: 12px;">
|
| 702 |
<div style="margin-bottom: 24px;">
|
| 703 |
<div style="display: inline-block; background: #3b82f6; color: #fff; padding: 6px 12px;
|
| 704 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 705 |
-
|
| 706 |
</div>
|
| 707 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Fale com a IA</h3>
|
| 708 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
@@ -713,7 +713,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 713 |
<li>A IA interpreta e seleciona automaticamente</li>
|
| 714 |
</ul>
|
| 715 |
<div style="background: #e0f2fe; padding: 10px; border-radius: 8px; margin-top: 10px; border-left: 3px solid #0284c7;">
|
| 716 |
-
<strong style="color: #0c4a6e;">
|
| 717 |
<code style="color: #0369a1; font-size: 12px;">
|
| 718 |
• "Pegue só as partes emocionantes"<br>
|
| 719 |
• "Remova tudo que fala sobre política"<br>
|
|
@@ -726,7 +726,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 726 |
<div style="margin-bottom: 24px;">
|
| 727 |
<div style="display: inline-block; background: #fbbf24; color: #000; padding: 6px 12px;
|
| 728 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 729 |
-
|
| 730 |
</div>
|
| 731 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Controle Absoluto</h3>
|
| 732 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
@@ -740,7 +740,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 740 |
<div style="margin-bottom: 24px;">
|
| 741 |
<div style="display: inline-block; background: #39FF14; color: #000; padding: 6px 12px;
|
| 742 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 743 |
-
|
| 744 |
</div>
|
| 745 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Seleção Inteligente</h3>
|
| 746 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
@@ -753,7 +753,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 753 |
</div>
|
| 754 |
|
| 755 |
<div style="background: #fef3c7; padding: 14px; border-radius: 10px; border: 1px solid #fcd34d; margin-top: 20px;">
|
| 756 |
-
<strong style="color: #78350f;">
|
| 757 |
<ol style="margin: 8px 0 0; padding-left: 20px; color: #92400e; line-height: 1.7;">
|
| 758 |
<li><strong>Minutagens Manuais</strong> - Ignora tudo</li>
|
| 759 |
<li><strong>Instruções Naturais com IA</strong> - Ignora palavras-chave e pesos</li>
|
|
|
|
| 570 |
with gr.Column():
|
| 571 |
gr.HTML("""<div style="background: linear-gradient(135deg, #f9fafb 0%, #fff 100%);
|
| 572 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 573 |
+
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 8px;"> Arquivos de entrada</div>
|
| 574 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Envie o XML exportado do Premiere e a transcrição</p>
|
| 575 |
</div>""")
|
| 576 |
xml_in = gr.File(label="XML da sequência (FCP XML)", file_types=[".xml"])
|
|
|
|
| 579 |
with gr.Column():
|
| 580 |
gr.HTML("""<div style="background: linear-gradient(135deg, rgba(57,255,20,0.08) 0%, rgba(57,255,20,0.02) 100%);
|
| 581 |
padding: 16px; border-radius: 16px; border: 1px solid #e5e7eb; margin-bottom: 16px;">
|
| 582 |
+
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 8px;"> Configurações básicas</div>
|
| 583 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Ajuste o comportamento do processamento</p>
|
| 584 |
</div>""")
|
| 585 |
use_llm = gr.Checkbox(
|
| 586 |
+
label=" Usar Potência Criativa (IA)",
|
| 587 |
value=USE_LLM_DEFAULT and LLM_AVAILABLE,
|
| 588 |
info="Usa IA para escolher os melhores trechos narrativamente"
|
| 589 |
)
|
|
|
|
| 593 |
info="Quantos trechos incluir no vídeo final"
|
| 594 |
)
|
| 595 |
|
| 596 |
+
with gr.Accordion(" INSTRUÇÕES EM LINGUAGEM NATURAL (IA) - NOVO!", open=True):
|
| 597 |
gr.HTML("""<div style="background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
|
| 598 |
padding: 14px; border-radius: 12px; border: 1px solid #93c5fd; margin-bottom: 12px;">
|
| 599 |
+
<strong style="color: #1e3a8a;"> Fale naturalmente com a IA!</strong>
|
| 600 |
<p style="color: #1e40af; font-size: 13px; margin: 6px 0 0; line-height: 1.6;">
|
| 601 |
Descreva o que você quer em texto simples. A IA vai interpretar e selecionar os trechos certos.
|
| 602 |
<br><strong>Prioridade:</strong> Se preencher este campo, ele tem preferência sobre palavras-chave e pesos.
|
|
|
|
| 616 |
)
|
| 617 |
gr.HTML("""
|
| 618 |
<div style="padding: 12px; background: #f0f9ff; border-radius: 10px; margin-top: 12px; border: 1px solid #bae6fd;">
|
| 619 |
+
<div style="font-weight: 600; margin-bottom: 8px; color: #0c4a6e;"> Como funciona:</div>
|
| 620 |
<ul style="margin: 0; padding-left: 20px; color: #0c4a6e; font-size: 13px; line-height: 1.7;">
|
| 621 |
<li>A IA lê toda a transcrição com timecodes</li>
|
| 622 |
<li>Interpreta suas instruções em português natural</li>
|
|
|
|
| 626 |
</div>
|
| 627 |
""")
|
| 628 |
|
| 629 |
+
with gr.Accordion(" MINUTAGENS MANUAIS (Controle Absoluto)", open=False):
|
| 630 |
gr.HTML("""<div style="background: #fffbeb; padding: 12px; border-radius: 10px; border: 1px solid #fde68a; margin-bottom: 12px;">
|
| 631 |
+
<strong style="color: #92400e;"> Modo de Controle Total</strong>
|
| 632 |
<p style="color: #78350f; font-size: 13px; margin: 6px 0 0;">
|
| 633 |
Se preencher este campo, o app ignora TUDO (transcrição, IA, instruções, etc)
|
| 634 |
e corta EXATAMENTE o que você especificou.
|
|
|
|
| 650 |
</div>
|
| 651 |
""")
|
| 652 |
|
| 653 |
+
with gr.Accordion(" Palavras-chave Personalizadas (Modo Automático)", open=False):
|
| 654 |
custom_keywords = gr.Textbox(
|
| 655 |
label="Adicione palavras-chave importantes (separadas por vírgula)",
|
| 656 |
placeholder="Exemplo: transformação, resultado, método, estratégia",
|
| 657 |
info="Trechos com essas palavras terão prioridade máxima (peso 3.0) - Só funciona no modo automático"
|
| 658 |
)
|
| 659 |
|
| 660 |
+
with gr.Accordion(" Ajuste Fino dos Pesos de Pontuação (Modo Automático)", open=False):
|
| 661 |
gr.HTML("""<p style="color: #4b5563; margin-bottom: 16px;">
|
| 662 |
Ajuste a importância de cada categoria na pontuação heurística (modo automático)</p>""")
|
| 663 |
with gr.Row():
|
| 664 |
+
weight_emotion = gr.Slider(0, 5, value=2.0, step=0.1, label=" Emoção")
|
| 665 |
+
weight_break = gr.Slider(0, 5, value=1.5, step=0.1, label=" Quebra de expectativa")
|
| 666 |
with gr.Row():
|
| 667 |
+
weight_learn = gr.Slider(0, 5, value=1.2, step=0.1, label=" Aprendizado")
|
| 668 |
+
weight_viral = gr.Slider(0, 5, value=1.0, step=0.1, label=" Viralização")
|
| 669 |
|
| 670 |
gr.HTML("""<div style="margin: 24px 0; text-align: center;">
|
| 671 |
<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 16px 0;">
|
| 672 |
</div>""")
|
| 673 |
|
| 674 |
+
run_btn = gr.Button(" Processar e Gerar XML Editado", variant="primary", size="lg")
|
| 675 |
|
| 676 |
gr.HTML("""<div style="margin: 20px 0;">
|
| 677 |
<hr style="border: none; border-top: 1px solid #e5e7eb;">
|
| 678 |
</div>""")
|
| 679 |
|
| 680 |
gr.HTML("""<div style="text-align: center; margin-bottom: 16px;">
|
| 681 |
+
<div style="font-weight: 700; color: #1a1a1a; margin-bottom: 4px;"> Resultados</div>
|
| 682 |
<p style="color: #4b5563; font-size: 14px; margin: 0;">Resumo dos cortes e arquivo para download</p>
|
| 683 |
</div>""")
|
| 684 |
|
|
|
|
| 696 |
outputs=[resumo_out, file_out, status_out]
|
| 697 |
)
|
| 698 |
|
| 699 |
+
with gr.Accordion(" Guia de Uso Completo", open=False):
|
| 700 |
gr.HTML("""
|
| 701 |
<div style="padding: 16px; background: #f9fafb; border-radius: 12px;">
|
| 702 |
<div style="margin-bottom: 24px;">
|
| 703 |
<div style="display: inline-block; background: #3b82f6; color: #fff; padding: 6px 12px;
|
| 704 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 705 |
+
MODO 1: INSTRUÇÕES NATURAIS (NOVO!)
|
| 706 |
</div>
|
| 707 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Fale com a IA</h3>
|
| 708 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
|
|
| 713 |
<li>A IA interpreta e seleciona automaticamente</li>
|
| 714 |
</ul>
|
| 715 |
<div style="background: #e0f2fe; padding: 10px; border-radius: 8px; margin-top: 10px; border-left: 3px solid #0284c7;">
|
| 716 |
+
<strong style="color: #0c4a6e;"> Exemplos de comandos:</strong><br>
|
| 717 |
<code style="color: #0369a1; font-size: 12px;">
|
| 718 |
• "Pegue só as partes emocionantes"<br>
|
| 719 |
• "Remova tudo que fala sobre política"<br>
|
|
|
|
| 726 |
<div style="margin-bottom: 24px;">
|
| 727 |
<div style="display: inline-block; background: #fbbf24; color: #000; padding: 6px 12px;
|
| 728 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 729 |
+
MODO 2: MINUTAGENS MANUAIS
|
| 730 |
</div>
|
| 731 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Controle Absoluto</h3>
|
| 732 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
|
|
| 740 |
<div style="margin-bottom: 24px;">
|
| 741 |
<div style="display: inline-block; background: #39FF14; color: #000; padding: 6px 12px;
|
| 742 |
border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 10px;">
|
| 743 |
+
MODO 3: AUTOMÁTICO COM IA
|
| 744 |
</div>
|
| 745 |
<h3 style="margin: 8px 0; font-weight: 700; color: #1a1a1a;">Seleção Inteligente</h3>
|
| 746 |
<ul style="color: #374151; line-height: 1.8; padding-left: 20px;">
|
|
|
|
| 753 |
</div>
|
| 754 |
|
| 755 |
<div style="background: #fef3c7; padding: 14px; border-radius: 10px; border: 1px solid #fcd34d; margin-top: 20px;">
|
| 756 |
+
<strong style="color: #78350f;"> Ordem de Prioridade:</strong>
|
| 757 |
<ol style="margin: 8px 0 0; padding-left: 20px; color: #92400e; line-height: 1.7;">
|
| 758 |
<li><strong>Minutagens Manuais</strong> - Ignora tudo</li>
|
| 759 |
<li><strong>Instruções Naturais com IA</strong> - Ignora palavras-chave e pesos</li>
|