binary1ne commited on
Commit
8f5a433
·
verified ·
1 Parent(s): 330cf0c

Update webui_with_vnc.py

Browse files
Files changed (1) hide show
  1. webui_with_vnc.py +12 -2
webui_with_vnc.py CHANGED
@@ -5,7 +5,17 @@ import argparse
5
  import gradio as gr
6
  from src.webui.interface import theme_map, create_ui
7
 
 
 
 
 
8
 
 
 
 
 
 
 
9
 
10
  # # Example theme map for the argument parser (add more themes if you have them)
11
  # theme_map = {
@@ -82,8 +92,8 @@ def main():
82
 
83
  with gr.Tab("Web VNC"):
84
  # The iframe must point to the actual noVNC server (default: localhost:6080/vnc.html)
85
- gr.HTML(f'<p>{response}</p><iframe src="http://localhost:6080/vnc.html" width="100%" height="800" style="border:1px solid red;"></iframe>')
86
-
87
  demo.queue().launch(server_name=args.ip, server_port=args.port)
88
 
89
  if __name__ == "__main__":
 
5
  import gradio as gr
6
  from src.webui.interface import theme_map, create_ui
7
 
8
+ html="""
9
+ <div id="vnc-container" style="width:100%;height:800px;border:1px solid #ccc"></div>
10
+ <script type="module">
11
+ import RFB from "https://unpkg.com/@novnc/novnc/core/rfb.js";
12
 
13
+ const rfb = new RFB(document.getElementById('vnc-container'),
14
+ "ws://localhost:6080/websockify");
15
+ rfb.scaleViewport = true;
16
+ rfb.background = 'black';
17
+ </script>
18
+ """
19
 
20
  # # Example theme map for the argument parser (add more themes if you have them)
21
  # theme_map = {
 
92
 
93
  with gr.Tab("Web VNC"):
94
  # The iframe must point to the actual noVNC server (default: localhost:6080/vnc.html)
95
+ # gr.HTML(f'<iframe src="http://localhost:6080/vnc.html" width="100%" height="800" style="border:1px solid red;"></iframe>')
96
+ gr.HTML(html)
97
  demo.queue().launch(server_name=args.ip, server_port=args.port)
98
 
99
  if __name__ == "__main__":