Skip to content

Commit 7893dae

Browse files
Merge pull request #12 from deepgram/sr/fix-convert-response-to-dict
fix: checks response and converts to dict if needed
2 parents be10644 + d4a365a commit 7893dae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

deepgram_captions/converters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import json
12
from .helpers import chunk_array, replace_text_with_word
23

34

45
class DeepgramConverter:
56
def __init__(self, dg_response):
6-
self.response = dg_response
7+
if not isinstance(dg_response, dict):
8+
self.response = json.loads(dg_response.to_json())
9+
else:
10+
self.response = dg_response
711

812
def get_lines(self, line_length):
913
results = self.response["results"]

0 commit comments

Comments
 (0)