added gemini too
Browse files- controller.py +4 -0
- gemini_report_generator.py +4 -2
- orchestrator_functions.py +1 -0
controller.py
CHANGED
@@ -178,6 +178,7 @@ async def get_image(request: ImageRequest, authorization: str = Header(None)):
|
|
178 |
logger.info("Uploading the chart to supabase...")
|
179 |
image_public_url = await upload_file_to_supabase(f"{image_file_path}", unique_file_name)
|
180 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
|
|
181 |
return {"image_url": image_public_url}
|
182 |
# return FileResponse(image_file_path, media_type="image/png")
|
183 |
except Exception as e:
|
@@ -868,6 +869,7 @@ async def csv_chart(request: dict, authorization: str = Header(None)):
|
|
868 |
logger.info("Uploading the chart to supabase...")
|
869 |
image_public_url = await upload_file_to_supabase(f"{langchain_result[0]}", unique_file_name)
|
870 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
|
|
871 |
return {"image_url": image_public_url}
|
872 |
# return FileResponse(langchain_result[0], media_type="image/png")
|
873 |
|
@@ -890,6 +892,7 @@ async def csv_chart(request: dict, authorization: str = Header(None)):
|
|
890 |
logger.info("Uploading the chart to supabase...")
|
891 |
image_public_url = await upload_file_to_supabase(f"{groq_result}", unique_file_name)
|
892 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
|
|
893 |
return {"image_url": image_public_url}
|
894 |
# return FileResponse(groq_result, media_type="image/png")
|
895 |
|
@@ -904,6 +907,7 @@ async def csv_chart(request: dict, authorization: str = Header(None)):
|
|
904 |
logger.info("Uploading the chart to supabase...")
|
905 |
image_public_url = await upload_file_to_supabase(f"{langchain_paths[0]}", unique_file_name)
|
906 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
|
|
907 |
return {"image_url": image_public_url}
|
908 |
# return FileResponse(langchain_paths[0], media_type="image/png")
|
909 |
else:
|
|
|
178 |
logger.info("Uploading the chart to supabase...")
|
179 |
image_public_url = await upload_file_to_supabase(f"{image_file_path}", unique_file_name)
|
180 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
181 |
+
os.remove(image_file_path)
|
182 |
return {"image_url": image_public_url}
|
183 |
# return FileResponse(image_file_path, media_type="image/png")
|
184 |
except Exception as e:
|
|
|
869 |
logger.info("Uploading the chart to supabase...")
|
870 |
image_public_url = await upload_file_to_supabase(f"{langchain_result[0]}", unique_file_name)
|
871 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
872 |
+
os.remove(langchain_result[0])
|
873 |
return {"image_url": image_public_url}
|
874 |
# return FileResponse(langchain_result[0], media_type="image/png")
|
875 |
|
|
|
892 |
logger.info("Uploading the chart to supabase...")
|
893 |
image_public_url = await upload_file_to_supabase(f"{groq_result}", unique_file_name)
|
894 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
895 |
+
os.remove(groq_result)
|
896 |
return {"image_url": image_public_url}
|
897 |
# return FileResponse(groq_result, media_type="image/png")
|
898 |
|
|
|
907 |
logger.info("Uploading the chart to supabase...")
|
908 |
image_public_url = await upload_file_to_supabase(f"{langchain_paths[0]}", unique_file_name)
|
909 |
logger.info("Image uploaded to Supabase and Image URL is... ", {image_public_url})
|
910 |
+
os.remove(langchain_paths[0])
|
911 |
return {"image_url": image_public_url}
|
912 |
# return FileResponse(langchain_paths[0], media_type="image/png")
|
913 |
else:
|
gemini_report_generator.py
CHANGED
@@ -301,9 +301,10 @@ async def generate_csv_report(csv_url: str, query: str) -> FileBoxProps:
|
|
301 |
if os.path.exists(csv_path):
|
302 |
file_name = os.path.basename(csv_path)
|
303 |
try:
|
|
|
304 |
public_url = await upload_file_to_supabase(
|
305 |
file_path=csv_path,
|
306 |
-
file_name=
|
307 |
)
|
308 |
csv_files.append(FileProps(
|
309 |
fileName=file_name,
|
@@ -320,9 +321,10 @@ async def generate_csv_report(csv_url: str, query: str) -> FileBoxProps:
|
|
320 |
if os.path.exists(img_path):
|
321 |
file_name = os.path.basename(img_path)
|
322 |
try:
|
|
|
323 |
public_url = await upload_file_to_supabase(
|
324 |
file_path=img_path,
|
325 |
-
file_name=
|
326 |
)
|
327 |
image_files.append(FileProps(
|
328 |
fileName=file_name,
|
|
|
301 |
if os.path.exists(csv_path):
|
302 |
file_name = os.path.basename(csv_path)
|
303 |
try:
|
304 |
+
unique_file_name = f"{uuid.uuid4()}_{file_name}"
|
305 |
public_url = await upload_file_to_supabase(
|
306 |
file_path=csv_path,
|
307 |
+
file_name=unique_file_name
|
308 |
)
|
309 |
csv_files.append(FileProps(
|
310 |
fileName=file_name,
|
|
|
321 |
if os.path.exists(img_path):
|
322 |
file_name = os.path.basename(img_path)
|
323 |
try:
|
324 |
+
unique_file_name = f"{uuid.uuid4()}_{file_name}"
|
325 |
public_url = await upload_file_to_supabase(
|
326 |
file_path=img_path,
|
327 |
+
file_name=unique_file_name
|
328 |
)
|
329 |
image_files.append(FileProps(
|
330 |
fileName=file_name,
|
orchestrator_functions.py
CHANGED
@@ -590,6 +590,7 @@ async def csv_chart(csv_url: str, query: str):
|
|
590 |
unique_name = f'{uuid.uuid4()}.png'
|
591 |
public_url = await upload_file_to_supabase(image_path, unique_name)
|
592 |
print(f"Uploaded chart: {public_url}")
|
|
|
593 |
return {"image_url": public_url}
|
594 |
|
595 |
try:
|
|
|
590 |
unique_name = f'{uuid.uuid4()}.png'
|
591 |
public_url = await upload_file_to_supabase(image_path, unique_name)
|
592 |
print(f"Uploaded chart: {public_url}")
|
593 |
+
os.remove(image_path) # Remove the local image file after upload
|
594 |
return {"image_url": public_url}
|
595 |
|
596 |
try:
|