Update app.py
Browse files
app.py
CHANGED
|
@@ -40,14 +40,10 @@ def create_s3_client():
|
|
| 40 |
|
| 41 |
def read_json_from_s3():
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
except Exception as e:
|
| 48 |
-
yield f"Error reading JSON file from S3: {e}"
|
| 49 |
-
return None
|
| 50 |
-
|
| 51 |
return json_content
|
| 52 |
|
| 53 |
def get_titan_embedding(bedrock, doc_name, text, attempt=0, cutoff=10000):
|
|
|
|
| 40 |
|
| 41 |
def read_json_from_s3():
|
| 42 |
|
| 43 |
+
response = s3_client.get_object(Bucket=BUCKET_NAME, Key=EXTRACTIONS_PATH)
|
| 44 |
+
file_content = response['Body'].read().decode('utf-8')
|
| 45 |
+
json_content = json.loads(file_content)
|
| 46 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
return json_content
|
| 48 |
|
| 49 |
def get_titan_embedding(bedrock, doc_name, text, attempt=0, cutoff=10000):
|