inventwithdean commited on
Commit
3e68329
·
1 Parent(s): bb24a9f
Files changed (2) hide show
  1. app.py +1 -5
  2. yt_chat.py +5 -2
app.py CHANGED
@@ -13,7 +13,6 @@ from timing import TimeManager
13
  from validity import is_valid_rpm_url
14
  from yt_chat import StreamChatHost
15
  from prompts import system_prompt_tv_crew_guest, system_prompt_tv_crew_chat
16
- import pytchat
17
 
18
  # Remove these before uploading on Spaces
19
  # import dotenv
@@ -46,7 +45,7 @@ audience = Audience(client)
46
  guardian = Guardian(client_guard)
47
 
48
  timeManager = TimeManager(host, show_state)
49
- streamChatHost = StreamChatHost(client, tv_crew_chat, guardian, show_state)
50
 
51
  thread_time_manager = threading.Thread(target=timeManager.guest_time_limit, daemon=True)
52
  thread_time_manager.start()
@@ -328,7 +327,4 @@ src="https://www.youtube.com/embed/xBVJIJQg1FY?si=tsCm1DdajNCP45ho" title="YouTu
328
 
329
 
330
  if __name__ == "__main__":
331
- VIDEO_ID = "xBVJIJQg1FY"
332
- chat = pytchat.create(video_id=VIDEO_ID)
333
- show_state["chat"] = chat
334
  demo.launch(mcp_server=True)
 
13
  from validity import is_valid_rpm_url
14
  from yt_chat import StreamChatHost
15
  from prompts import system_prompt_tv_crew_guest, system_prompt_tv_crew_chat
 
16
 
17
  # Remove these before uploading on Spaces
18
  # import dotenv
 
45
  guardian = Guardian(client_guard)
46
 
47
  timeManager = TimeManager(host, show_state)
48
+ streamChatHost = StreamChatHost(client, tv_crew_chat, guardian)
49
 
50
  thread_time_manager = threading.Thread(target=timeManager.guest_time_limit, daemon=True)
51
  thread_time_manager.start()
 
327
 
328
 
329
  if __name__ == "__main__":
 
 
 
330
  demo.launch(mcp_server=True)
yt_chat.py CHANGED
@@ -1,9 +1,11 @@
1
  import os
 
2
  # from dotenv import load_dotenv
3
  from guard import Guardian
4
  from tv_crew import TVCrew
5
  import requests
6
  import time
 
7
 
8
  # load_dotenv()
9
  unreal_orchestrator_url = os.getenv("ORCHESTRATOR_URL")
@@ -14,7 +16,7 @@ POLL_INTERVAL = 3 # seconds
14
 
15
 
16
  class StreamChatHost:
17
- def __init__(self, client, tv_crew: TVCrew, guardian: Guardian, show_state: dict):
18
  self.client = client
19
  self.guardian = guardian
20
  self.tv_crew = tv_crew
@@ -28,7 +30,8 @@ Keep your responses short, like two or three sentences, and be witty."""
28
 
29
  self.messages = [self.system_message]
30
  self.headers = {"Content-Type": "application/json", "x-api-key": api_key_unreal}
31
- self.chat = show_state["chat"]
 
32
 
33
  def chat_interaction_loop(self):
34
  """Checks if the Host is in lobby, then pulls chat messages from the Live Stream. The Host then replies to the message."""
 
1
  import os
2
+
3
  # from dotenv import load_dotenv
4
  from guard import Guardian
5
  from tv_crew import TVCrew
6
  import requests
7
  import time
8
+ import pytchat
9
 
10
  # load_dotenv()
11
  unreal_orchestrator_url = os.getenv("ORCHESTRATOR_URL")
 
16
 
17
 
18
  class StreamChatHost:
19
+ def __init__(self, client, tv_crew: TVCrew, guardian: Guardian):
20
  self.client = client
21
  self.guardian = guardian
22
  self.tv_crew = tv_crew
 
30
 
31
  self.messages = [self.system_message]
32
  self.headers = {"Content-Type": "application/json", "x-api-key": api_key_unreal}
33
+ VIDEO_ID = "xBVJIJQg1FY"
34
+ self.chat = pytchat.create(video_id=VIDEO_ID)
35
 
36
  def chat_interaction_loop(self):
37
  """Checks if the Host is in lobby, then pulls chat messages from the Live Stream. The Host then replies to the message."""