Spaces:
Sleeping
Sleeping
Ajuste diretório download e chamada ao tratamento de arquivos
Browse files- agent.py +1 -1
- image_util.py +1 -4
- tools.py +3 -5
agent.py
CHANGED
|
@@ -64,7 +64,7 @@ class Agent:
|
|
| 64 |
]
|
| 65 |
}
|
| 66 |
)
|
| 67 |
-
print('........ Versão:
|
| 68 |
print(f"Resposta LLM: {response}")
|
| 69 |
# Extrair o conteúdo das mensagens do tipo AIMessage
|
| 70 |
final_content = ""
|
|
|
|
| 64 |
]
|
| 65 |
}
|
| 66 |
)
|
| 67 |
+
print('........ Versão: Ajuste diretórios tasks e tmp .....')
|
| 68 |
print(f"Resposta LLM: {response}")
|
| 69 |
# Extrair o conteúdo das mensagens do tipo AIMessage
|
| 70 |
final_content = ""
|
image_util.py
CHANGED
|
@@ -15,11 +15,8 @@ class Image_Util:
|
|
| 15 |
def encode_image_to_base64(image_path: str) -> str:
|
| 16 |
"""Codifica um arquivo de imagem (frame) para base64."""
|
| 17 |
|
| 18 |
-
image_path_tratado = File_Util.tratar_arquivo_local(image_path)
|
| 19 |
-
if not image_path_tratado:
|
| 20 |
-
return None
|
| 21 |
try:
|
| 22 |
-
with open(
|
| 23 |
return base64.b64encode(image_file.read()).decode('utf-8')
|
| 24 |
except FileNotFoundError:
|
| 25 |
print(f"Erro: Arquivo não encontrado em {image_path}")
|
|
|
|
| 15 |
def encode_image_to_base64(image_path: str) -> str:
|
| 16 |
"""Codifica um arquivo de imagem (frame) para base64."""
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
try:
|
| 19 |
+
with open(image_path, "rb") as image_file:
|
| 20 |
return base64.b64encode(image_file.read()).decode('utf-8')
|
| 21 |
except FileNotFoundError:
|
| 22 |
print(f"Erro: Arquivo não encontrado em {image_path}")
|
tools.py
CHANGED
|
@@ -66,9 +66,7 @@ def execute_python_code_tool(code_path: str) -> str:
|
|
| 66 |
saida = io.StringIO()
|
| 67 |
erros = io.StringIO()
|
| 68 |
|
| 69 |
-
final_code_path = File_Util.
|
| 70 |
-
if not final_code_path:
|
| 71 |
-
return f"Erro: Arquivo não encontrado em {code_path}"
|
| 72 |
print(f"Executando código em {final_code_path}...")
|
| 73 |
|
| 74 |
try:
|
|
@@ -601,7 +599,7 @@ def get_excel_columns_tool(file_path: str) -> list[str]:
|
|
| 601 |
List of column names.
|
| 602 |
|
| 603 |
"""
|
| 604 |
-
final_excel_path = File_Util.
|
| 605 |
print(f"Extraindo as colunas do arquivo {file_path}")
|
| 606 |
|
| 607 |
df = pd.read_excel(final_excel_path, nrows=0)
|
|
@@ -618,7 +616,7 @@ def calculate_excel_sum_by_columns_tool(
|
|
| 618 |
- file_path: Path to the Excel file.
|
| 619 |
- include_columns: Columns included in the sum
|
| 620 |
"""
|
| 621 |
-
final_excel_path = File_Util.
|
| 622 |
print(f"Calculando soma de {include_columns} em {final_excel_path}")
|
| 623 |
|
| 624 |
df = pd.read_excel(final_excel_path)
|
|
|
|
| 66 |
saida = io.StringIO()
|
| 67 |
erros = io.StringIO()
|
| 68 |
|
| 69 |
+
final_code_path = File_Util.baixa_arquivo_task(code_path)
|
|
|
|
|
|
|
| 70 |
print(f"Executando código em {final_code_path}...")
|
| 71 |
|
| 72 |
try:
|
|
|
|
| 599 |
List of column names.
|
| 600 |
|
| 601 |
"""
|
| 602 |
+
final_excel_path = File_Util.baixa_arquivo_task(file_path)
|
| 603 |
print(f"Extraindo as colunas do arquivo {file_path}")
|
| 604 |
|
| 605 |
df = pd.read_excel(final_excel_path, nrows=0)
|
|
|
|
| 616 |
- file_path: Path to the Excel file.
|
| 617 |
- include_columns: Columns included in the sum
|
| 618 |
"""
|
| 619 |
+
final_excel_path = File_Util.baixa_arquivo_task(file_path)
|
| 620 |
print(f"Calculando soma de {include_columns} em {final_excel_path}")
|
| 621 |
|
| 622 |
df = pd.read_excel(final_excel_path)
|