brian-xetdata commited on
Commit
06ec643
·
1 Parent(s): ba9cd3c

Adding side-by-side comparison

Browse files
Files changed (2) hide show
  1. app.py +0 -43
  2. proxy.py +22 -8
app.py DELETED
@@ -1,43 +0,0 @@
1
- from flask import Flask, request, redirect, Response
2
- import requests
3
-
4
-
5
- SITE_NAME ="http://127.0.0.1:8080/"
6
-
7
- app = Flask(__name__)
8
-
9
- @app.route('/netron', methods=['GET'])
10
- def proxy():
11
- global SITE_NAME
12
- if request.method=='GET':
13
- url = request.args.get('url')
14
- forward = f'{SITE_NAME}?url={url}'
15
- print(forward)
16
- resp = requests.get(forward)
17
- excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
18
- headers = [(name, value) for (name, value) in resp.raw.headers.items() if name.lower() not in excluded_headers]
19
- response = Response(resp.content, resp.status_code, headers)
20
- return response
21
-
22
- @app.get("/")
23
- def base():
24
- return """
25
- <html>
26
- <head>
27
- <title>Netron</title>
28
- <script type="text/javascript">
29
- function setFile() {
30
- console.log("setFile");
31
- var url = document.getElementById('url').value;
32
- var iframe = document.getElementById('netron');
33
- iframe.src = 'http://localhost:7860/?url=' + url;
34
- }
35
- </script>
36
- </head>
37
- <body style="padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center;">
38
- <input type="text" id="url" value="https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: 100%; height: 30px;"/>
39
- <button type="submit" style="width: 100%; height: 30px;" onClick="setFile">Load</button>
40
- <iframe id="netron" src="http://localhost:7860/?url=https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: 100%; height: 100%; border: none;"/>
41
- </body>
42
- </html>
43
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
proxy.py CHANGED
@@ -45,19 +45,33 @@ def chooser():
45
  <head>
46
  <title>Netron</title>
47
  <script type="text/javascript">
48
- function setFile() {
49
- var url = document.getElementById('url').value;
50
- var iframe = document.getElementById('netron');
 
 
 
 
 
51
  iframe.src = '/netron?url=' + url;
52
  }
53
  </script>
54
  </head>
55
- <body style="padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center;">
56
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between;">
57
- <input type="text" id="url" value="https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: calc(100% - 100px); height: 30px;"/>
58
- <button type="submit" style="height: 30px; width: 100px;" onClick="setFile">Load</button>
 
 
 
 
 
 
 
 
 
 
59
  </div>
60
- <iframe id="netron" src="/netron?url=https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: 100%; height: 95%; border: none;"/>
61
  </body>
62
  </html>
63
  """
 
45
  <head>
46
  <title>Netron</title>
47
  <script type="text/javascript">
48
+ function setFileBefore() {
49
+ var url = document.getElementById('urlbefore').value;
50
+ var iframe = document.getElementById('netronbefore');
51
+ iframe.src = '/netron?url=' + url;
52
+ }
53
+ function setFileAfter() {
54
+ var url = document.getElementById('urlafter').value;
55
+ var iframe = document.getElementById('netronafter');
56
  iframe.src = '/netron?url=' + url;
57
  }
58
  </script>
59
  </head>
60
+ <body style="padding: 0; margin: 0; display: flex; flex-direction: row; align-items: center;">
61
+ <div id="before" style="width: 50%; height: 100%; border-right: 1px solid gray">
62
+ <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between;">
63
+ <input type="text" id="urlbefore" value="https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: calc(100% - 100px); height: 30px;"/>
64
+ <button type="submit" style="height: 30px; width: 100px;" onClick="setFileBefore">Load</button>
65
+ </div>
66
+ <iframe id="netronbefore" src="/netron?url=https://huggingface.co/brianronan/chessbot-test/resolve/main/chessbot.pb" style="width: 100%; height: calc(100% - 30px); border: none;"></iframe>
67
+ </div>
68
+ <div id="after" style="width: 50%; height: 100%;">
69
+ <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between;">
70
+ <input type="text" id="urlafter" value="https://huggingface.co/brianronan/chessbot-test/resolve/updated/chessbot.pb" style="width: calc(100% - 100px); height: 30px;"/>
71
+ <button type="submit" style="height: 30px; width: 100px;" onClick="setFileAfter">Load</button>
72
+ </div>
73
+ <iframe id="netronafter" src="/netron?url=https://huggingface.co/brianronan/chessbot-test/resolve/updated/chessbot.pb" style="width: 100%; height: calc(100% - 30px); border: none;"></iframe>
74
  </div>
 
75
  </body>
76
  </html>
77
  """