Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,14 +134,14 @@ 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 |
-
cleaned_content = re.sub(r'^```json\n', '', content) # Remove '```json\n' at the beginning
|
| 138 |
-
cleaned_content = re.sub(r'\n```$', '', cleaned_content) # Remove '\n```' at the end
|
| 139 |
|
| 140 |
# Step 2: Parse the cleaned content as JSON
|
| 141 |
-
parsed_content = json.loads(cleaned_content)
|
| 142 |
|
| 143 |
# Step 3: Print the parsed JSON object
|
| 144 |
-
return parsed_content
|
| 145 |
except Exception as e:
|
| 146 |
return f"Error in summarization: {str(e)}"
|
| 147 |
# Dependency to check API Key
|
|
|
|
| 134 |
max_tokens=16384
|
| 135 |
)
|
| 136 |
content = response.choices[0].message.content.strip()
|
| 137 |
+
#cleaned_content = re.sub(r'^```json\n', '', content) # Remove '```json\n' at the beginning
|
| 138 |
+
#cleaned_content = re.sub(r'\n```$', '', cleaned_content) # Remove '\n```' at the end
|
| 139 |
|
| 140 |
# Step 2: Parse the cleaned content as JSON
|
| 141 |
+
#parsed_content = json.loads(cleaned_content)
|
| 142 |
|
| 143 |
# Step 3: Print the parsed JSON object
|
| 144 |
+
return content # parsed_content
|
| 145 |
except Exception as e:
|
| 146 |
return f"Error in summarization: {str(e)}"
|
| 147 |
# Dependency to check API Key
|