Jon Taylor commited on
Commit
f66623b
1 Parent(s): 98b5e62

moved buffer into loop

Browse files
app/bot.py CHANGED
@@ -101,11 +101,6 @@ class DailyVision(EventHandler):
101
  })
102
 
103
  def process_frames(self):
104
- if self.__params_buffer:
105
- print("New buffer params found")
106
- print(self.__params_buffer)
107
- self.__params = self.__pipeline.InputParams(**self.__params_buffer)
108
-
109
  params = self.__params
110
 
111
  while not self.__app_quit:
@@ -123,6 +118,11 @@ class DailyVision(EventHandler):
123
  #video_frame = self.__queue.get(timeout=5)
124
  video_frame = self.__image_buffer
125
 
 
 
 
 
 
126
  if not video_frame == None:
127
  image = Image.frombytes("RGB", (video_frame.width, video_frame.height), video_frame.buffer)
128
  result_image = self.__pipeline.predict(params, image)
 
101
  })
102
 
103
  def process_frames(self):
 
 
 
 
 
104
  params = self.__params
105
 
106
  while not self.__app_quit:
 
118
  #video_frame = self.__queue.get(timeout=5)
119
  video_frame = self.__image_buffer
120
 
121
+ if self.__params_buffer:
122
+ print("New buffer params found")
123
+ params = self.__pipeline.InputParams(**self.__params_buffer)
124
+ self.__params_buffer = None
125
+
126
  if not video_frame == None:
127
  image = Image.frombytes("RGB", (video_frame.width, video_frame.height), video_frame.buffer)
128
  result_image = self.__pipeline.predict(params, image)
frontend/app/components/Call.js CHANGED
@@ -14,6 +14,8 @@ const STATE_LEFT = "left";
14
  const BOT_STATE_STARTING = "bot_starting";
15
  const BOT_STATE_STARTED = "bot_started";
16
 
 
 
17
  export default function Call() {
18
  const daily = useDaily();
19
  const [callState, setCallState] = useState(STATE_IDLE);
 
14
  const BOT_STATE_STARTING = "bot_starting";
15
  const BOT_STATE_STARTED = "bot_started";
16
 
17
+ //@TODO change to portrait constraints and update UI
18
+ //@TODO Disable simulcast
19
  export default function Call() {
20
  const daily = useDaily();
21
  const [callState, setCallState] = useState(STATE_IDLE);
frontend/app/components/CreateRoom.js CHANGED
@@ -32,65 +32,71 @@ export default function CreateRoom({ onCreateRoom }) {
32
  }
33
 
34
  return (
35
- <div className="bg-white shadow sm:rounded-lg max-w-xl mx-auto">
36
- <div className="px-4 py-5 sm:p-6">
37
- <h3 className="text-base font-semibold leading-6 text-gray-900">
38
- What is this
39
- </h3>
40
- <div className="mt-2 text-sm text-gray-500">
41
- <p>Explanation goes here</p>
42
- </div>
43
- <div className="mt-5">
44
- <Button
45
- rightSection={<IconArrowRight stroke={2} className="h-5 w-5" />}
46
- size="md"
47
- loading={fetching}
48
- onClick={() => create()}
49
- >
50
- Join
51
- </Button>
52
- </div>
 
 
 
 
 
53
 
54
- <hr className="my-6" />
55
 
56
- <div
57
- className="inline-flex items-center gap-1 text-sm text-gray-500 cursor-pointer"
58
- onClick={() => setShowManual(!showManual)}
59
- >
60
- Join an existing room
61
- <IconChevronRight
62
- stoke={2}
63
- className={`w-4 h-4 text-gray-300 transition-transform ${
64
- showManual && "rotate-90"
65
- }`}
66
- />
67
- </div>
68
 
69
- {showManual && (
70
- <div className="mt-5 sm:flex sm:items-center">
71
- <div className="w-full">
72
- <label htmlFor="room" className="sr-only">
73
- Daily Room URL
74
- </label>
75
- <input
76
- type="text"
77
- name="room"
78
- id="room"
79
- className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
80
- placeholder="https://..."
81
- onChange={(e) => setRoomUrl(e.target.value)}
82
- />
 
 
 
 
 
 
 
 
83
  </div>
84
- <button
85
- type="submit"
86
- onClick={() => onCreateRoom(roomUrl)}
87
- className="mt-3 inline-flex w-full items-center justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:ml-3 sm:mt-0 sm:w-auto"
88
- >
89
- Join
90
- </button>
91
- </div>
92
- )}
93
  </div>
94
- </div>
95
  );
96
  }
 
32
  }
33
 
34
  return (
35
+ <main className="min-h-screen flex items-center justify-center bg-zinc-100">
36
+ <div className="flex-1 bg-white shadow sm:rounded-lg max-w-xl mx-auto">
37
+ <div className="px-4 py-5 sm:p-6">
38
+ <h3 className="text-base font-semibold leading-6 text-gray-900">
39
+ Stable Diffusion + WebRTC Latency Demo
40
+ </h3>
41
+ <div className="mt-2 text-sm text-gray-500">
42
+ <p>
43
+ Demonstrates implementating WebRTC via daily.co to create
44
+ real-time vision inference. Currently implemented using SD 1.5
45
+ Turbo with Control Net.
46
+ </p>
47
+ </div>
48
+ <div className="mt-5">
49
+ <Button
50
+ rightSection={<IconArrowRight stroke={2} className="h-5 w-5" />}
51
+ size="md"
52
+ loading={fetching}
53
+ onClick={() => create()}
54
+ >
55
+ Join
56
+ </Button>
57
+ </div>
58
 
59
+ <hr className="my-6" />
60
 
61
+ <div
62
+ className="inline-flex items-center gap-1 text-sm text-gray-500 cursor-pointer"
63
+ onClick={() => setShowManual(!showManual)}
64
+ >
65
+ Join an existing room
66
+ <IconChevronRight
67
+ stoke={2}
68
+ className={`w-4 h-4 text-gray-300 transition-transform ${
69
+ showManual && "rotate-90"
70
+ }`}
71
+ />
72
+ </div>
73
 
74
+ {showManual && (
75
+ <div className="mt-5 sm:flex sm:items-center">
76
+ <div className="w-full">
77
+ <label htmlFor="room" className="sr-only">
78
+ Daily Room URL
79
+ </label>
80
+ <input
81
+ type="text"
82
+ name="room"
83
+ id="room"
84
+ className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
85
+ placeholder="https://..."
86
+ onChange={(e) => setRoomUrl(e.target.value)}
87
+ />
88
+ </div>
89
+ <button
90
+ type="submit"
91
+ onClick={() => onCreateRoom(roomUrl)}
92
+ className="mt-3 inline-flex w-full items-center justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:ml-3 sm:mt-0 sm:w-auto"
93
+ >
94
+ Join
95
+ </button>
96
  </div>
97
+ )}
98
+ </div>
 
 
 
 
 
 
 
99
  </div>
100
+ </main>
101
  );
102
  }
frontend/app/components/Joining.js CHANGED
@@ -11,12 +11,14 @@ export default function Join({ roomUrl, onJoin }) {
11
  });
12
 
13
  return (
14
- <div className="bg-white shadow sm:rounded-lg max-w-xl mx-auto">
15
- <div className="px-4 py-5 sm:p-6">
16
- <h3 className="text-base font-semibold leading-6 text-gray-900">
17
- Joining...
18
- </h3>
 
 
19
  </div>
20
- </div>
21
  );
22
  }
 
11
  });
12
 
13
  return (
14
+ <main className="min-h-screen flex items-center justify-center bg-zinc-200">
15
+ <div className="bg-white shadow sm:rounded-lg max-w-xl mx-auto">
16
+ <div className="px-4 py-5 sm:p-6">
17
+ <h3 className="text-base font-semibold leading-6 text-gray-900">
18
+ Joining...
19
+ </h3>
20
+ </div>
21
  </div>
22
+ </main>
23
  );
24
  }