qgallouedec HF Staff commited on
Commit
613b59c
·
verified ·
1 Parent(s): 46a699e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +12 -19
index.html CHANGED
@@ -1,11 +1,3 @@
1
- <div style="padding-bottom: 10px; display: flex; gap: 10px; align-items: center;">
2
- <input id="original_url" type="text" placeholder="Original file URL" style="flex: 1; padding: 6px; font-size: 13px;"
3
- value="https://trl-lib-diff-view.static.hf.space/grpo_trainer.py" />
4
- <input id="modified_url" type="text" placeholder="Modified file URL" style="flex: 1; padding: 6px; font-size: 13px;"
5
- value="https://trl-lib-diff-view.static.hf.space/rloo_trainer.py" />
6
- <button onclick="loadDiff()" style="padding: 6px 14px; font-size: 13px;">Load</button>
7
- </div>
8
-
9
  <div style="padding-bottom: 20px;">
10
  <div id="trl_diff" style="width: 100%; height: 400px; border: 1px solid grey;"></div>
11
  </div>
@@ -15,11 +7,11 @@
15
  const proxy = URL.createObjectURL(
16
  new Blob(
17
  [`
18
- self.MonacoEnvironment = {
19
- baseUrl: 'https://unpkg.com/monaco-editor@latest/min/'
20
- };
21
- importScripts('https://unpkg.com/monaco-editor@latest/min/vs/base/worker/workerMain.js');
22
- `],
23
  { type: "text/javascript" }
24
  )
25
  );
@@ -40,14 +32,15 @@
40
  loadDiff();
41
  });
42
 
 
 
 
43
  function loadDiff() {
44
- const originalUrl = document.getElementById("original_url").value.trim();
45
- const modifiedUrl = document.getElementById("modified_url").value.trim();
46
- if (!diffEditor || !originalUrl || !modifiedUrl) return;
47
 
48
  Promise.all([
49
- fetch(originalUrl).then(r => r.text()),
50
- fetch(modifiedUrl).then(r => r.text())
51
  ]).then(([originalTxt, modifiedTxt]) => {
52
  diffEditor.setModel({
53
  original: monaco.editor.createModel(originalTxt, "python"),
@@ -55,4 +48,4 @@
55
  });
56
  });
57
  }
58
- </script>
 
 
 
 
 
 
 
 
 
1
  <div style="padding-bottom: 20px;">
2
  <div id="trl_diff" style="width: 100%; height: 400px; border: 1px solid grey;"></div>
3
  </div>
 
7
  const proxy = URL.createObjectURL(
8
  new Blob(
9
  [`
10
+ self.MonacoEnvironment = {
11
+ baseUrl: 'https://unpkg.com/monaco-editor@latest/min/'
12
+ };
13
+ importScripts('https://unpkg.com/monaco-editor@latest/min/vs/base/worker/workerMain.js');
14
+ `],
15
  { type: "text/javascript" }
16
  )
17
  );
 
32
  loadDiff();
33
  });
34
 
35
+ const ORIGINAL_URL = "https://trl-lib-diff-view.static.hf.space/grpo_trainer.py";
36
+ const MODIFIED_URL = "https://trl-lib-diff-view.static.hf.space/rloo_trainer.py";
37
+
38
  function loadDiff() {
39
+ if (!diffEditor) return;
 
 
40
 
41
  Promise.all([
42
+ fetch(ORIGINAL_URL).then(r => r.text()),
43
+ fetch(MODIFIED_URL).then(r => r.text())
44
  ]).then(([originalTxt, modifiedTxt]) => {
45
  diffEditor.setModel({
46
  original: monaco.editor.createModel(originalTxt, "python"),
 
48
  });
49
  });
50
  }
51
+ </script>