Spaces:
Paused
Paused
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -170,14 +170,18 @@ def run_crew(question, file_path):
|
|
| 170 |
try:
|
| 171 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 172 |
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
| 175 |
else:
|
| 176 |
file = client.files.upload(file=file_path)
|
|
|
|
| 177 |
|
| 178 |
response = client.models.generate_content(
|
| 179 |
model=DOCUMENT_ANALYSIS_MODEL,
|
| 180 |
-
contents=
|
| 181 |
)
|
| 182 |
|
| 183 |
return response.text
|
|
|
|
| 170 |
try:
|
| 171 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 172 |
|
| 173 |
+
contents = []
|
| 174 |
+
|
| 175 |
+
if is_ext(file_path, ".docx")
|
| 176 |
+
file_data = read_docx(file_path)
|
| 177 |
+
contents = [f"{question}\n{file_data}"]
|
| 178 |
else:
|
| 179 |
file = client.files.upload(file=file_path)
|
| 180 |
+
contents = [file, question]
|
| 181 |
|
| 182 |
response = client.models.generate_content(
|
| 183 |
model=DOCUMENT_ANALYSIS_MODEL,
|
| 184 |
+
contents=contents
|
| 185 |
)
|
| 186 |
|
| 187 |
return response.text
|