Spaces:
Running
on
T4
Running
on
T4
Mark Duppenthaler
commited on
Commit
•
7fb1760
1
Parent(s):
366edf8
dummpy outputs
Browse files- __pycache__/sample_wav.cpython-310.pyc +0 -0
- __pycache__/simuleval_transcoder.cpython-310.pyc +0 -0
- app.py +21 -1
- sample_wav.py +0 -0
__pycache__/sample_wav.cpython-310.pyc
ADDED
Binary file (136 kB). View file
|
|
__pycache__/simuleval_transcoder.cpython-310.pyc
CHANGED
Binary files a/__pycache__/simuleval_transcoder.cpython-310.pyc and b/__pycache__/simuleval_transcoder.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -6,6 +6,9 @@ import gradio as gr
|
|
6 |
import numpy as np
|
7 |
import torch
|
8 |
import torchaudio
|
|
|
|
|
|
|
9 |
|
10 |
from simuleval_transcoder import *
|
11 |
|
@@ -45,6 +48,15 @@ def translate_audio_segment(audio):
|
|
45 |
logger.debug(f"translate_audio_segment: incoming audio")
|
46 |
sample_rate, data = audio
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
transcoder.process_incoming_bytes(data.tobytes(), 'eng', sample_rate)
|
49 |
|
50 |
speech_and_text_output = transcoder.get_buffered_output()
|
@@ -67,6 +79,9 @@ def translate_audio_segment(audio):
|
|
67 |
|
68 |
return speech, text
|
69 |
|
|
|
|
|
|
|
70 |
def streaming_input_callback(
|
71 |
audio_file, translated_audio_bytes_state, translated_text_state
|
72 |
):
|
@@ -76,9 +91,14 @@ def streaming_input_callback(
|
|
76 |
|
77 |
# TODO: accumulate each segment to provide a continuous audio segment
|
78 |
|
|
|
|
|
|
|
79 |
if translated_wav_segment is not None:
|
80 |
sample_rate, audio_bytes = translated_wav_segment
|
81 |
-
|
|
|
|
|
82 |
|
83 |
|
84 |
# combine translated wav
|
|
|
6 |
import numpy as np
|
7 |
import torch
|
8 |
import torchaudio
|
9 |
+
import sys
|
10 |
+
from sample_wav import sample_wav
|
11 |
+
np.set_printoptions(threshold=sys.maxsize)
|
12 |
|
13 |
from simuleval_transcoder import *
|
14 |
|
|
|
48 |
logger.debug(f"translate_audio_segment: incoming audio")
|
49 |
sample_rate, data = audio
|
50 |
|
51 |
+
# print(sample_rate)
|
52 |
+
# print("--------- start \n")
|
53 |
+
# # print(data)
|
54 |
+
# def map(x):
|
55 |
+
# return x
|
56 |
+
# print(data.tolist())
|
57 |
+
# print("--------- end \n")
|
58 |
+
|
59 |
+
|
60 |
transcoder.process_incoming_bytes(data.tobytes(), 'eng', sample_rate)
|
61 |
|
62 |
speech_and_text_output = transcoder.get_buffered_output()
|
|
|
79 |
|
80 |
return speech, text
|
81 |
|
82 |
+
def dummy_ouput():
|
83 |
+
np.array()
|
84 |
+
|
85 |
def streaming_input_callback(
|
86 |
audio_file, translated_audio_bytes_state, translated_text_state
|
87 |
):
|
|
|
91 |
|
92 |
# TODO: accumulate each segment to provide a continuous audio segment
|
93 |
|
94 |
+
# TEMP
|
95 |
+
translated_wav_segment = (46_000, sample_wav())
|
96 |
+
|
97 |
if translated_wav_segment is not None:
|
98 |
sample_rate, audio_bytes = translated_wav_segment
|
99 |
+
# TODO: convert to 16 bit int
|
100 |
+
# audio_np_array = np.frombuffer(audio_bytes, dtype=np.float32, count=3)
|
101 |
+
audio_np_array = audio_bytes
|
102 |
|
103 |
|
104 |
# combine translated wav
|
sample_wav.py
ADDED
The diff for this file is too large to render.
See raw diff
|
|