reduced chunk size
Browse files
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -24,9 +24,16 @@ async def create_file(
|
|
24 |
),
|
25 |
):
|
26 |
# Write the file to disk asynchronously
|
|
|
27 |
try:
|
28 |
async with aiofiles.open(file.filename, "wb") as f:
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
await f.write(contents)
|
31 |
|
32 |
except Exception:
|
@@ -35,12 +42,7 @@ async def create_file(
|
|
35 |
await file.close()
|
36 |
|
37 |
# telegram
|
38 |
-
|
39 |
-
-1001925049183,
|
40 |
-
file_size=file.size,
|
41 |
-
caption=file.filename,
|
42 |
-
file=f"./{file.filename}",
|
43 |
-
)
|
44 |
# celery task
|
45 |
task = transcription_task.delay(file.filename, model)
|
46 |
|
|
|
24 |
),
|
25 |
):
|
26 |
# Write the file to disk asynchronously
|
27 |
+
data = None
|
28 |
try:
|
29 |
async with aiofiles.open(file.filename, "wb") as f:
|
30 |
+
data = await bot.send_file(
|
31 |
+
-1001925049183,
|
32 |
+
file_size=file.size,
|
33 |
+
caption=file.filename,
|
34 |
+
file=file,
|
35 |
+
)
|
36 |
+
while contents := await file.read(1024 * 1):
|
37 |
await f.write(contents)
|
38 |
|
39 |
except Exception:
|
|
|
42 |
await file.close()
|
43 |
|
44 |
# telegram
|
45 |
+
|
|
|
|
|
|
|
|
|
|
|
46 |
# celery task
|
47 |
task = transcription_task.delay(file.filename, model)
|
48 |
|