Ashrafb commited on
Commit
2c2300d
·
verified ·
1 Parent(s): 13f9424

Create static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +55 -0
static/index.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AnimeGANv3 Interface</title>
7
+ </head>
8
+ <body>
9
+ <h1>AnimeGANv3 Interface</h1>
10
+ <input type="file" id="fileInput">
11
+ <select id="styleSelect">
12
+ <option value="AnimeGANv3_Hayao">AnimeGANv3_Hayao</option>
13
+ <option value="AnimeGANv3_Shinkai">AnimeGANv3_Shinkai</option>
14
+ <option value="AnimeGANv3_Arcane">AnimeGANv3_Arcane</option>
15
+ <option value="AnimeGANv3_USA">AnimeGANv3_USA</option>
16
+ <option value="AnimeGANv3_Trump v1.0">AnimeGANv3_Trump v1.0</option>
17
+ <option value="AnimeGANv3_Disney v1.0">AnimeGANv3_Disney v1.0</option>
18
+ <option value="AnimeGANv3_PortraitSketch">AnimeGANv3_PortraitSketch</option>
19
+ <option value="AnimeGANv3_JP_face v1.0">AnimeGANv3_JP_face v1.0</option>
20
+ <option value="AnimeGANv3_Kpop v2.0">AnimeGANv3_Kpop v2.0</option>
21
+ </select>
22
+ <label for="faceExtract">Extract face:</label>
23
+ <input type="checkbox" id="faceExtract" checked>
24
+ <button onclick="uploadImage()">Upload & Convert</button>
25
+
26
+ <script>
27
+ async function uploadImage() {
28
+ const fileInput = document.getElementById('fileInput');
29
+ const styleSelect = document.getElementById('styleSelect');
30
+ const faceExtract = document.getElementById('faceExtract');
31
+
32
+ const file = fileInput.files[0];
33
+ const style = styleSelect.value;
34
+ const extractFace = faceExtract.checked ? 'Yes' : 'No';
35
+
36
+ const formData = new FormData();
37
+ formData.append('img_path', file);
38
+ formData.append('Style', style);
39
+ formData.append('if_face', extractFace);
40
+
41
+ try {
42
+ const response = await fetch('http://localhost:8000/inference/', {
43
+ method: 'POST',
44
+ body: formData
45
+ });
46
+ const data = await response.json();
47
+ const outputPath = data.save_path;
48
+ window.open(`http://localhost:8000/download/${outputPath}`, '_blank');
49
+ } catch (error) {
50
+ console.error('Error:', error);
51
+ }
52
+ }
53
+ </script>
54
+ </body>
55
+ </html>