import requests import json import streamlit as st @st.experimental_memo() def upload_file(file, api_key, ai_id): file_data = {"file": file} url = f'https://gptbase.ai/api/v1/ais/{ai_id}/files' headers = {"Authorization": f"Bearer {api_key}"} try: response = requests.post(url, headers=headers, files=file_data) print("upload") return True except requests.exceptions.HTTPError as err: return False