Create webui_with_vnc.py
Browse files- webui_with_vnc.py +15 -0
webui_with_vnc.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
def greet(name):
|
| 5 |
+
return f"Hello {name}!"
|
| 6 |
+
|
| 7 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 8 |
+
|
| 9 |
+
# Serve noVNC files inside /web-vnc
|
| 10 |
+
novnc_path = "/web-ui/static/novnc"
|
| 11 |
+
|
| 12 |
+
if os.path.exists(novnc_path):
|
| 13 |
+
demo.add_static_route("/web-vnc", novnc_path)
|
| 14 |
+
|
| 15 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|