Spaces:
Sleeping
Sleeping
from supabase_models import Supabase_Client | |
def store_message_data(message_id:str , attachment_id:str): | |
if attachment_id and message_id: | |
extension = attachment.filename.split(".")[-1] | |
file_name = f"{message.id}_{attachment.attachment_id}.{extension}" | |
print(f"file_name: {file_name}") | |
supabase = Supabase_Client().instance | |
try: | |
response = supabase.storage.from_("receipt_radar").download( | |
file_name | |
) | |
base64_data = urlsafe_b64encode(response).decode('utf-8') | |
return base64_data | |
except Exception as e: | |
print(f"Error downloading or encoding file: {e}") |