fix js errors when restarting UI

This commit is contained in:
AUTOMATIC 2023-01-12 19:47:44 +03:00
parent 5623a3e7b1
commit 6ffefdcc9f

View file

@ -1,5 +1,6 @@
function gradioApp() {
const gradioShadowRoot = document.getElementsByTagName('gradio-app')[0].shadowRoot
const elems = document.getElementsByTagName('gradio-app')
const gradioShadowRoot = elems.length == 0 ? null : elems[0].shadowRoot
return !!gradioShadowRoot ? gradioShadowRoot : document;
}