Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,8 +134,9 @@ This JSON format will be used to store and manage invoices in a structured and u
|
|
| 134 |
max_tokens=16384
|
| 135 |
)
|
| 136 |
content = response.choices[0].message.content.strip()
|
| 137 |
-
|
| 138 |
-
cleaned_content = re.sub(r'
|
|
|
|
| 139 |
|
| 140 |
# Step 2: Parse the cleaned content as JSON
|
| 141 |
#parsed_content = json.loads(cleaned_content)
|
|
|
|
| 134 |
max_tokens=16384
|
| 135 |
)
|
| 136 |
content = response.choices[0].message.content.strip()
|
| 137 |
+
print("Before content:", content)
|
| 138 |
+
cleaned_content = re.sub(r'^```json', '', content) # Remove '```json\n' at the beginning
|
| 139 |
+
cleaned_content = re.sub(r'```$', '', cleaned_content) # Remove '\n```' at the end
|
| 140 |
|
| 141 |
# Step 2: Parse the cleaned content as JSON
|
| 142 |
#parsed_content = json.loads(cleaned_content)
|