Spaces:
Runtime error
Runtime error
EC2 Default User
commited on
Commit
•
23c1d69
1
Parent(s):
21d2d39
xxx
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import json
|
|
6 |
import numpy as np
|
7 |
import wave
|
8 |
import io
|
|
|
9 |
from langchain import OpenAI
|
10 |
from langchain.chains import ConversationChain
|
11 |
from langchain.memory import ConversationSummaryBufferMemory
|
@@ -13,6 +14,18 @@ from langchain.chat_models import ChatOpenAI
|
|
13 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
14 |
from langchain.schema import HumanMessage
|
15 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Run a shell command
|
18 |
command = "which ffmpeg"
|
@@ -42,6 +55,9 @@ conversation = ConversationChain(
|
|
42 |
memory=memory,
|
43 |
)
|
44 |
|
|
|
|
|
|
|
45 |
AUDIO_PATH = ''
|
46 |
CHUNK_SIZE = 1024 * 8
|
47 |
REGION = "us-west-2"
|
|
|
6 |
import numpy as np
|
7 |
import wave
|
8 |
import io
|
9 |
+
import os
|
10 |
from langchain import OpenAI
|
11 |
from langchain.chains import ConversationChain
|
12 |
from langchain.memory import ConversationSummaryBufferMemory
|
|
|
14 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
15 |
from langchain.schema import HumanMessage
|
16 |
import subprocess
|
17 |
+
from contextlib import closing
|
18 |
+
import asyncio
|
19 |
+
|
20 |
+
# This example uses aiofile for asynchronous file reads.
|
21 |
+
# It's not a dependency of the project but can be installed
|
22 |
+
# with `pip install aiofile`.
|
23 |
+
import aiofile
|
24 |
+
|
25 |
+
from amazon_transcribe.client import TranscribeStreamingClient
|
26 |
+
from amazon_transcribe.handlers import TranscriptResultStreamHandler
|
27 |
+
from amazon_transcribe.model import TranscriptEvent
|
28 |
+
from amazon_transcribe.utils import apply_realtime_delay
|
29 |
|
30 |
# Run a shell command
|
31 |
command = "which ffmpeg"
|
|
|
55 |
memory=memory,
|
56 |
)
|
57 |
|
58 |
+
SAMPLE_RATE = 16000
|
59 |
+
BYTES_PER_SAMPLE = 2
|
60 |
+
CHANNEL_NUMS = 1
|
61 |
AUDIO_PATH = ''
|
62 |
CHUNK_SIZE = 1024 * 8
|
63 |
REGION = "us-west-2"
|