Prajwal-r-k commited on
Commit
9841e57
·
verified ·
1 Parent(s): e3eb054

Upload 2 files

Browse files
Files changed (2) hide show
  1. outputs/Dockerfile +16 -0
  2. uploads/templates_index.html +60 -0
outputs/Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ # Install system libraries
4
+ RUN apt-get update && apt-get install -y libgl1 git-lfs
5
+
6
+ # Copy your app files
7
+ COPY . /app
8
+ WORKDIR /app
9
+
10
+ # Pull LFS files
11
+ RUN cd NAFNet && git lfs install && git lfs pull
12
+
13
+ # Install Python dependencies
14
+ RUN pip install -r requirements.txt
15
+
16
+ CMD ["python", "app.py"]
uploads/templates_index.html ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Image Enhancement with NAFNet</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; margin: 20px; }
9
+ .image-container { display: flex; gap: 20px; margin-top: 20px; }
10
+ img { max-width: 300px; height: auto; border: 1px solid #ccc; }
11
+ .hidden { display: none; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>Upload Image for AI Enhancement (NAFNet)</h1>
16
+ <input type="file" id="fileInput" accept="image/*">
17
+ <button id="enhanceButton">Enhance Image</button>
18
+
19
+ <div class="image-container hidden" id="imageResults">
20
+ <div>
21
+ <h3>Original Image:</h3>
22
+ <img id="beforeImage" src="" alt="Before Image">
23
+ </div>
24
+ <div>
25
+ <h3>Enhanced Image:</h3>
26
+ <img id="afterImage" src="" alt="Enhanced Image">
27
+ </div>
28
+ </div>
29
+
30
+ <script>
31
+ document.getElementById('enhanceButton').addEventListener('click', function () {
32
+ const fileInput = document.getElementById('fileInput');
33
+ if (!fileInput.files.length) {
34
+ alert('Please select an image.');
35
+ return;
36
+ }
37
+
38
+ const file = fileInput.files[0];
39
+ const formData = new FormData();
40
+ formData.append('file', file);
41
+
42
+ fetch('/process_image', {
43
+ method: 'POST',
44
+ body: formData,
45
+ })
46
+ .then(response => response.json())
47
+ .then(data => {
48
+ if (data.status === 'success') {
49
+ document.getElementById('beforeImage').src = URL.createObjectURL(file);
50
+ document.getElementById('afterImage').src = data.output_path;
51
+ document.getElementById('imageResults').classList.remove('hidden');
52
+ } else {
53
+ alert('Processing failed: ' + data.message);
54
+ }
55
+ })
56
+ .catch(error => console.error('Error:', error));
57
+ });
58
+ </script>
59
+ </body>
60
+ </html>