TRaw commited on
Commit
12918ef
·
verified ·
1 Parent(s): 2afd211

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def xterm_webpage():
5
+ html_code = """
6
+ <!doctype html>
7
+ <html>
8
+ <head>
9
+ <link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
10
+ <script src="node_modules/xterm/lib/xterm.js"></script>
11
+ </head>
12
+ <body>
13
+ <div id="terminal"></div>
14
+ <script>
15
+ var term = new Terminal();
16
+ term.open(document.getElementById('terminal'));
17
+ term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
18
+ </script>
19
+ </body>
20
+ </html>
21
+ """
22
+ return gr.HTML(html_code)
23
+
24
+ iface = gr.Interface(fn=xterm_webpage, live=True)
25
+ iface.launch()