Spaces:
Runtime error
Runtime error
Commit
·
66f1e8b
1
Parent(s):
00684fc
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ def _read_file(filename, chunk_size=5242880):
|
|
23 |
break
|
24 |
yield data
|
25 |
|
26 |
-
def get_transcript_url(url
|
27 |
|
28 |
# JSON that tells the API which file to trancsribe
|
29 |
json={
|
@@ -92,72 +92,72 @@ def get_transcript_url(url, audio_intelligence_options):
|
|
92 |
|
93 |
return transcription_result['text'], transcription_result['summary'], sentiment_analysis_result
|
94 |
|
95 |
-
def get_transcript_file(filename):
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
|
162 |
audio_intelligence_list = [
|
163 |
"Summarization",
|
|
|
23 |
break
|
24 |
yield data
|
25 |
|
26 |
+
def get_transcript_url(url):
|
27 |
|
28 |
# JSON that tells the API which file to trancsribe
|
29 |
json={
|
|
|
92 |
|
93 |
return transcription_result['text'], transcription_result['summary'], sentiment_analysis_result
|
94 |
|
95 |
+
# def get_transcript_file(filename):
|
96 |
|
97 |
+
# upload_response = requests.post(
|
98 |
+
# upload_endpoint,
|
99 |
+
# headers=headers,
|
100 |
+
# data=_read_file(filename))
|
101 |
|
102 |
+
# # JSON that tells the API which file to trancsribe
|
103 |
+
# json = {
|
104 |
+
# # URL of the audio file to process
|
105 |
+
# "audio_url": upload_response.json()['upload_url'],
|
106 |
+
|
107 |
+
# # Turn on speaker labels
|
108 |
+
# "speaker_labels": True,
|
109 |
+
|
110 |
+
# # Turn on custom vocabulary
|
111 |
+
# "word_boost": ["assembly ai"],
|
112 |
+
|
113 |
+
# # Turn on custom spelling
|
114 |
+
# "custom_spelling": [
|
115 |
+
# {"from": ["assembly AI"], "to": "AssemblyAI"},
|
116 |
+
# {"from": ["assembly AI's"], "to": "AssemblyAI's"}
|
117 |
+
# ],
|
118 |
+
|
119 |
+
# # Turn on PII Redaction and specify policies
|
120 |
+
# "redact_pii": True,
|
121 |
+
# "redact_pii_policies": ["drug", "injury", "person_name"],
|
122 |
+
# "redact_pii_audio": True,
|
123 |
+
|
124 |
+
# # Turn on Auto Highlights
|
125 |
+
# "auto_highlights": True,
|
126 |
+
|
127 |
+
# # Turn on Content Moderation
|
128 |
+
# "content_safety": True,
|
129 |
+
|
130 |
+
# # Turn on Topic Detection
|
131 |
+
# "iab_categories": True,
|
132 |
+
|
133 |
+
# # Turn on Sentiment Analysis
|
134 |
+
# "sentiment_analysis": True,
|
135 |
+
|
136 |
+
# # Turn on Summarization and specify configuration
|
137 |
+
# "summarization": True,
|
138 |
+
# "summary_model": "informative",
|
139 |
+
# "summary_type": "bullets",
|
140 |
+
|
141 |
+
# # Turn on Entity Detection
|
142 |
+
# "entity_detection": True,
|
143 |
+
# }
|
144 |
+
|
145 |
+
# response = requests.post(
|
146 |
+
# transcript_endpoint,
|
147 |
+
# json=json,
|
148 |
+
# headers=headers # Authorization to link this transcription with your account
|
149 |
+
# )
|
150 |
+
|
151 |
+
# polling_endpoint = f"https://api.assemblyai.com/v2/transcript/{response.json()['id']}"
|
152 |
+
# while True:
|
153 |
+
# transcription_result = requests.get(polling_endpoint, headers=headers).json()
|
154 |
+
# if transcription_result['status'] == 'completed':
|
155 |
+
# break
|
156 |
+
# elif transcription_result['status'] == 'error':
|
157 |
+
# raise RuntimeError(f"Transcription failed: {transcription_result['error']}")
|
158 |
+
# else:
|
159 |
+
# time.sleep(3)
|
160 |
+
# return transcription_result['text']
|
161 |
|
162 |
audio_intelligence_list = [
|
163 |
"Summarization",
|