Spaces:
Paused
Paused
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -421,16 +421,16 @@ def run_crew(question, file_path):
|
|
| 421 |
if file_path:
|
| 422 |
if is_ext(file_path, ".csv") or is_ext(file_path, ".xls") or is_ext(file_path, ".xlsx") or is_ext(file_path, ".json") or is_ext(file_path, ".jsonl"):
|
| 423 |
json_data = read_file_json(file_path)
|
| 424 |
-
final_question = f"{question}
|
| 425 |
else:
|
| 426 |
-
final_question = f"{question}
|
| 427 |
|
| 428 |
-
|
| 429 |
-
final_answer = get_final_answer(FINAL_ANSWER_MODEL,
|
| 430 |
|
| 431 |
print(f"=> Initial question: {question}")
|
| 432 |
print(f"=> Final question: {final_question}")
|
| 433 |
-
print(f"=> Initial answer: {
|
| 434 |
print(f"=> Final answer: {final_answer}")
|
| 435 |
|
| 436 |
return final_answer
|
|
|
|
| 421 |
if file_path:
|
| 422 |
if is_ext(file_path, ".csv") or is_ext(file_path, ".xls") or is_ext(file_path, ".xlsx") or is_ext(file_path, ".json") or is_ext(file_path, ".jsonl"):
|
| 423 |
json_data = read_file_json(file_path)
|
| 424 |
+
final_question = f"{question} JSON data:\n{json_data}."
|
| 425 |
else:
|
| 426 |
+
final_question = f"{question} File path: {file_path}."
|
| 427 |
|
| 428 |
+
answer = crew.kickoff(inputs={"question": final_question})
|
| 429 |
+
final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(answer))
|
| 430 |
|
| 431 |
print(f"=> Initial question: {question}")
|
| 432 |
print(f"=> Final question: {final_question}")
|
| 433 |
+
print(f"=> Initial answer: {answer}")
|
| 434 |
print(f"=> Final answer: {final_answer}")
|
| 435 |
|
| 436 |
return final_answer
|