Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,23 +9,22 @@ def demo():
|
|
9 |
collection_name = gr.State()
|
10 |
|
11 |
gr.Markdown(
|
12 |
-
"""<center><h2>
|
13 |
-
<h3>Faça qualquer pergunta sobre seus
|
14 |
gr.Markdown(
|
15 |
-
"""<b>Nota:</b> Este assistente de IA, utilizando Langchain e LLMs de código aberto, realiza geração aumentada por recuperação (RAG) a partir de seus
|
16 |
-
A interface do usuário
|
17 |
-
Este chatbot leva em consideração perguntas anteriores ao gerar respostas (via memória conversacional), e inclui referências documentais para maior clareza.<br>
|
18 |
<br><b>Aviso:</b> Este espaço usa a CPU básica gratuita do Hugging Face. Algumas etapas e modelos LLM utilizados abaixo (pontos finais de inferência gratuitos) podem levar algum tempo para gerar uma resposta.
|
19 |
""")
|
20 |
|
21 |
-
with gr.Tab("Etapa 1 - Carregar
|
22 |
with gr.Row():
|
23 |
-
document = gr.Files(height=100, file_count="multiple", file_types=["pdf"], interactive=True, label="Carregue seus
|
24 |
|
25 |
-
with gr.Tab("Etapa 2 - Processar
|
26 |
with gr.Row():
|
27 |
db_btn = gr.Radio(["ChromaDB"], label="Tipo de banco de dados vetorial", value = "ChromaDB", type="index", info="Escolha o banco de dados vetorial")
|
28 |
-
with gr.Accordion("Opções avançadas - Divisor de texto do
|
29 |
with gr.Row():
|
30 |
slider_chunk_size = gr.Slider(minimum = 100, maximum = 1000, value=600, step=20, label="Tamanho do bloco", info="Tamanho do bloco", interactive=True)
|
31 |
with gr.Row():
|
@@ -53,7 +52,7 @@ def demo():
|
|
53 |
|
54 |
with gr.Tab("Etapa 4 - Chatbot"):
|
55 |
chatbot = gr.Chatbot(height=300)
|
56 |
-
with gr.Accordion("Avançado - Referências do
|
57 |
with gr.Row():
|
58 |
doc_source1 = gr.Textbox(label="Referência 1", lines=2, container=True, scale=20)
|
59 |
source1_page = gr.Number(label="Página", scale=1)
|
@@ -64,7 +63,7 @@ def demo():
|
|
64 |
doc_source3 = gr.Textbox(label="Referência 3", lines=2, container=True, scale=20)
|
65 |
source3_page = gr.Number(label="Página", scale=1)
|
66 |
with gr.Row():
|
67 |
-
msg = gr.Textbox(placeholder="Digite a mensagem (exemplo: '
|
68 |
with gr.Row():
|
69 |
submit_btn = gr.Button("Enviar mensagem")
|
70 |
clear_btn = gr.ClearButton([msg, chatbot], value="Limpar conversa")
|
@@ -97,4 +96,4 @@ def demo():
|
|
97 |
|
98 |
|
99 |
if __name__ == "__main__":
|
100 |
-
demo()
|
|
|
9 |
collection_name = gr.State()
|
10 |
|
11 |
gr.Markdown(
|
12 |
+
"""<center><h2>Assistente de Análise de Relatórios de Metrologia</center></h2>
|
13 |
+
<h3>Faça qualquer pergunta sobre seus relatórios de metrologia</h3>""")
|
14 |
gr.Markdown(
|
15 |
+
"""<b>Nota:</b> Este assistente de IA, utilizando Langchain e LLMs de código aberto, realiza geração aumentada por recuperação (RAG) a partir de seus relatórios de metrologia em formato PDF. \
|
16 |
+
A interface do usuário está organizada para facilitar o entendimento do fluxo de trabalho do RAG. Este chatbot leva em consideração perguntas anteriores ao gerar respostas, e inclui referências documentais para maior clareza.<br>
|
|
|
17 |
<br><b>Aviso:</b> Este espaço usa a CPU básica gratuita do Hugging Face. Algumas etapas e modelos LLM utilizados abaixo (pontos finais de inferência gratuitos) podem levar algum tempo para gerar uma resposta.
|
18 |
""")
|
19 |
|
20 |
+
with gr.Tab("Etapa 1 - Carregar Relatórios"):
|
21 |
with gr.Row():
|
22 |
+
document = gr.Files(height=100, file_count="multiple", file_types=["pdf"], interactive=True, label="Carregue seus relatórios de metrologia (único ou múltiplos)")
|
23 |
|
24 |
+
with gr.Tab("Etapa 2 - Processar Relatórios"):
|
25 |
with gr.Row():
|
26 |
db_btn = gr.Radio(["ChromaDB"], label="Tipo de banco de dados vetorial", value = "ChromaDB", type="index", info="Escolha o banco de dados vetorial")
|
27 |
+
with gr.Accordion("Opções avançadas - Divisor de texto do relatório", open=False):
|
28 |
with gr.Row():
|
29 |
slider_chunk_size = gr.Slider(minimum = 100, maximum = 1000, value=600, step=20, label="Tamanho do bloco", info="Tamanho do bloco", interactive=True)
|
30 |
with gr.Row():
|
|
|
52 |
|
53 |
with gr.Tab("Etapa 4 - Chatbot"):
|
54 |
chatbot = gr.Chatbot(height=300)
|
55 |
+
with gr.Accordion("Avançado - Referências do Relatório", open=False):
|
56 |
with gr.Row():
|
57 |
doc_source1 = gr.Textbox(label="Referência 1", lines=2, container=True, scale=20)
|
58 |
source1_page = gr.Number(label="Página", scale=1)
|
|
|
63 |
doc_source3 = gr.Textbox(label="Referência 3", lines=2, container=True, scale=20)
|
64 |
source3_page = gr.Number(label="Página", scale=1)
|
65 |
with gr.Row():
|
66 |
+
msg = gr.Textbox(placeholder="Digite a mensagem (exemplo: 'Qual a precisão dos instrumentos utilizados?')", container=True)
|
67 |
with gr.Row():
|
68 |
submit_btn = gr.Button("Enviar mensagem")
|
69 |
clear_btn = gr.ClearButton([msg, chatbot], value="Limpar conversa")
|
|
|
96 |
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
+
demo()
|