-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
197 lines (180 loc) · 5.95 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fracture Finder</title>
<style>
a {
text-decoration: none;
}
.navbar {
background-color: grey;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
padding: 15px;
}
.navdiv {
display: flex;
align-items: center;
justify-content: space-between;
}
.logo a {
font-size: 35px;
font-weight: 600;
color: white;
}
li {
list-style: none;
display: inline-block;
}
li a {
color: white;
font-weight: bold;
margin: 18px;
}
.nav-button {
display: inline-block;
background-color: black;
color: white;
border: none;
border-radius: 10px;
padding: 8px 15px;
text-align: center;
font-weight: bold;
cursor: pointer;
text-decoration: none;
}
.nav-button:hover {
background-color: grey;
}
body{background-image:url(bone.png);}
h1 {font-family:Verdana;
color:white }
h3 {font-size:16px;
color:white;}
p{color:white;}
label{font-family:'Times New Roman', Times, serif;
color:white;
text-align:center}
h1 {
color: white;
}
h3 {
font-size: 16px;
color: white;
}
p {
color: white;
}
label {
font-family: 'Times New Roman', Times, serif;
color: white;
}
#uploadedImage {
margin-top: 20px;
max-width: 100%;
max-height: 400px;
border: 2px solid white;
display: block;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid white;
color: white;
background-color: black;
}
.file-button {
display: inline-block;
background-color: white;
color: black;
border: none;
border-radius: 10px;
padding: 8px 15px;
text-align: center;
font-weight: bold;
cursor: pointer;
}
.file-button:hover {
background-color: lightgray;
}
.highlighted-text {
background-color: black;
color: white;
padding: 10px;
display: inline-block;}
</style>
</head>
<body>
<nav class="navbar">
<div class="navdiv">
<div class="logo"><a href="index.html">Fracture Finder</a></div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Instructions_page.html">Instructions</a></li>
<li><a href="Forum_page.html">Forum</a></li>
<li><a href="Sign_In_page.html" class="nav-button">Sign In</a></li>
<li><a href="Sign_Up_page.html" class="nav-button">Sign Up</a></li>
</ul>
</div>
</nav>
<p class="highlighted-text">PROTOTYPE/DEMO FOR ESC 120.</p>
<form id="fileForm">
<label for="fileInput" class="file-button">Choose File</label>
<input type="file" id="fileInput" name="file" accept="image/*" style="display: none;">
<button type="submit" class="file-button">Analyze</button>
</form>
<img class="highlighted-text" id="uploadedImage" alt="Uploaded image preview will appear here" />
<div id="result">
<h3>AI Analysis Output:</h3>
<p class="highlighted-text" id="analysisOutput">Submit a file for analysis.</p>
</div>
<div id="loadingSpinner" style="display: none;">Processing...</div>
<script>
const fileInput = document.getElementById('fileInput');
const uploadedImage = document.getElementById('uploadedImage');
const analysisOutput = document.getElementById('analysisOutput');
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
uploadedImage.src = e.target.result;
uploadedImage.style.display = "block";
};
reader.readAsDataURL(file);
} else {
uploadedImage.src = "";
uploadedImage.style.display = "none";
}
});
document.getElementById('fileForm').addEventListener('submit', async (event) => {
event.preventDefault();
const file = fileInput.files[0];
if (!file) {
alert('Please select a file.');
return;
}
analysisOutput.innerText = "";
document.getElementById("loadingSpinner").style.display = "block";
const formData = new FormData();
formData.append('file', file);
try {
const response = await fetch('URL', {
method: 'POST',
body: formData,
});
const data = await response.json();
if (data.error) {
analysisOutput.innerText = `Error: ${data.error}`;
} else {
analysisOutput.innerText = data.result;
}
} catch (error) {
console.error('Error:', error);
analysisOutput.innerText = 'Error while processing.';
}
});
</script>
</body>
</html>