Spaces:
Runtime error
Runtime error
fix use of ray.get inside aync
Browse files- charles_actor.py +3 -3
- streamlit_av_queue.py +7 -7
charles_actor.py
CHANGED
|
@@ -54,7 +54,7 @@ class CharlesActor:
|
|
| 54 |
if len(self._debug_queue) > 0:
|
| 55 |
prompt = self._debug_queue.pop(0)
|
| 56 |
await self._chat_pipeline.enqueue(prompt)
|
| 57 |
-
audio_frames = self._streamlit_av_queue.
|
| 58 |
if len(audio_frames) > 0:
|
| 59 |
total_audio_frames += len(audio_frames)
|
| 60 |
# Concatenate all audio frames into a single buffer
|
|
@@ -70,7 +70,7 @@ class CharlesActor:
|
|
| 70 |
table_content += "\n".join([f"| {item} |" for item in reversed(system_one_audio_history)])
|
| 71 |
self._system_one_audio_history_output = table_content
|
| 72 |
await self._chat_pipeline.enqueue(prompt)
|
| 73 |
-
video_frames = self._streamlit_av_queue.
|
| 74 |
if len(video_frames) > 0:
|
| 75 |
total_video_frames += len(video_frames)
|
| 76 |
# for video_frame in video_frames:
|
|
@@ -115,6 +115,6 @@ if __name__ == "__main__":
|
|
| 115 |
# The start method is still running. You can poll for debug information here.
|
| 116 |
time.sleep(1)
|
| 117 |
state = charles_actor.get_state.remote()
|
| 118 |
-
print(f"Charles is in state: {ray.get(state)}")
|
| 119 |
except KeyboardInterrupt:
|
| 120 |
print("Script was manually terminated")
|
|
|
|
| 54 |
if len(self._debug_queue) > 0:
|
| 55 |
prompt = self._debug_queue.pop(0)
|
| 56 |
await self._chat_pipeline.enqueue(prompt)
|
| 57 |
+
audio_frames = await self._streamlit_av_queue.get_audio_frames_async()
|
| 58 |
if len(audio_frames) > 0:
|
| 59 |
total_audio_frames += len(audio_frames)
|
| 60 |
# Concatenate all audio frames into a single buffer
|
|
|
|
| 70 |
table_content += "\n".join([f"| {item} |" for item in reversed(system_one_audio_history)])
|
| 71 |
self._system_one_audio_history_output = table_content
|
| 72 |
await self._chat_pipeline.enqueue(prompt)
|
| 73 |
+
video_frames = await self._streamlit_av_queue.get_video_frames_async()
|
| 74 |
if len(video_frames) > 0:
|
| 75 |
total_video_frames += len(video_frames)
|
| 76 |
# for video_frame in video_frames:
|
|
|
|
| 115 |
# The start method is still running. You can poll for debug information here.
|
| 116 |
time.sleep(1)
|
| 117 |
state = charles_actor.get_state.remote()
|
| 118 |
+
# print(f"Charles is in state: {ray.get(state)}")
|
| 119 |
except KeyboardInterrupt:
|
| 120 |
print("Script was manually terminated")
|
streamlit_av_queue.py
CHANGED
|
@@ -65,11 +65,11 @@ class StreamlitAVQueue:
|
|
| 65 |
new_frame.sample_rate = frame.sample_rate
|
| 66 |
new_frames.append(new_frame)
|
| 67 |
return new_frames
|
| 68 |
-
|
| 69 |
-
def
|
| 70 |
-
shared_buffers =
|
| 71 |
return shared_buffers
|
| 72 |
-
|
| 73 |
-
def
|
| 74 |
-
shared_tensors =
|
| 75 |
-
return shared_tensors
|
|
|
|
| 65 |
new_frame.sample_rate = frame.sample_rate
|
| 66 |
new_frames.append(new_frame)
|
| 67 |
return new_frames
|
| 68 |
+
|
| 69 |
+
async def get_audio_frames_async(self) -> List[av.AudioFrame]:
|
| 70 |
+
shared_buffers = await self.queue_actor.get_audio_frames.remote()
|
| 71 |
return shared_buffers
|
| 72 |
+
|
| 73 |
+
async def get_video_frames_async(self) -> List[av.AudioFrame]:
|
| 74 |
+
shared_tensors = await self.queue_actor.get_video_frames.remote()
|
| 75 |
+
return shared_tensors
|