tonyassi commited on
Commit
15089a5
·
verified ·
1 Parent(s): 08f658f

Delete index.html

Browse files
Files changed (1) hide show
  1. index.html +0 -297
index.html DELETED
@@ -1,297 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
5
- <title>Flask Chat App</title>
6
- <style>
7
- body, html {
8
- margin: 0;
9
- padding: 0;
10
- width: 100%;
11
- height: 100%;
12
- background-color: #d3d3d3;
13
- display: flex;
14
- flex-direction: column;
15
- align-items: center;
16
- justify-content: flex-start;
17
- font-family: Arial, sans-serif;
18
- font-weight: 300;
19
- }
20
- #image-container {
21
- padding-top: 2%;
22
- width: auto;
23
- height: auto;
24
- }
25
- #image-container img {
26
- width: auto;
27
- height: 35vh;
28
- display: block;
29
- max-width: 100%;
30
- }
31
-
32
- #chat-container, #input-container {
33
- width: 90%;
34
- max-width: 1200px;
35
- margin: 10px;
36
- }
37
- #chat-container {
38
- flex: 1;
39
- overflow-y: auto;
40
- background-color: white;
41
- border-radius: 10px;
42
- padding: 2%;
43
- box-shadow: 0 0 10px rgba(0,0,0,0.1);
44
- display: flex;
45
- flex-direction: column;
46
- }
47
- .chat-bubble {
48
- margin: 5px;
49
- padding: 10px;
50
- border-radius: 10px;
51
- max-width: 80%;
52
- }
53
- .user-bubble {
54
- align-self: flex-end;
55
- background-color: #e0e0e0;
56
- }
57
- .bot-bubble {
58
- align-self: flex-start;
59
- background-color: #ffb6c1;
60
- color: white;
61
- }
62
- #input-container {
63
- display: flex;
64
- align-items: center;
65
- padding-bottom: 2%;
66
- }
67
- #input-container input {
68
- flex: 1;
69
- padding: 10px;
70
- border: 1px solid #ccc;
71
- border-radius: 5px;
72
- height: 2.5vh;
73
- }
74
-
75
- #input-container button {
76
- padding: 0;
77
- margin-left: 10px;
78
- border: none;
79
- background-color: transparent;
80
- cursor: pointer;
81
- height: calc(2.5vh + 15px);
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- }
86
-
87
- #input-container button img {
88
- height: 100%;
89
- width: auto;
90
- }
91
-
92
- .menu {
93
- position: absolute;
94
- top: 10px;
95
- left: 10px;
96
- z-index: 1000;
97
- }
98
-
99
- .menu .hamburger {
100
- display: block;
101
- cursor: pointer;
102
- width: 30px;
103
- height: 30px;
104
- }
105
-
106
- .menu .hamburger div {
107
- width: 100%;
108
- height: 4px;
109
- background-color: black;
110
- margin: 5px 0;
111
- transition: all 0.3s;
112
- }
113
-
114
- .menu-content {
115
- display: none;
116
- position: absolute;
117
- top: 40px;
118
- left: 0;
119
- background-color: white;
120
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
121
- border-radius: 5px;
122
- overflow: hidden;
123
- width: 150px;
124
- }
125
-
126
- .menu-content a {
127
- display: block;
128
- padding: 5px 10px;
129
- color: black;
130
- text-decoration: none;
131
- transition: background-color 0.3s;
132
- }
133
-
134
- .menu-content a:hover {
135
- background-color: #f0f0f0;
136
- }
137
-
138
- #audio-recording-container {
139
- display: none;
140
- align-items: center;
141
- justify-content: center;
142
- width: 90%;
143
- max-width: 1200px;
144
- margin: 10px;
145
- padding-top: 7%;
146
- }
147
-
148
- #audio-record-button {
149
- width: 150px;
150
- height: 150px;
151
- background-color: #e1fceb;
152
- color: black;
153
- border-radius: 50%;
154
- cursor: pointer;
155
- display: flex;
156
- align-items: center;
157
- justify-content: center;
158
- font-size: 16px;
159
- font-weight: bold;
160
- border: 5px solid white;
161
- box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.8);
162
- }
163
- #audio-record-button.recording {
164
- background-color: #f44336;
165
- box-shadow: 0 0 20px 10px rgba(255, 255, 255, 1);
166
- }
167
- </style>
168
- </head>
169
- <body>
170
- <div class="menu">
171
- <div class="hamburger" onclick="toggleMenu()">
172
- <div></div>
173
- <div></div>
174
- <div></div>
175
- </div>
176
- <div class="menu-content" id="menu-content">
177
- <a href="#" onclick="showTextChat()">Text Chat</a>
178
- <a href="#" onclick="showAudioChat()">Audio Chat</a>
179
- <a href="#">Settings</a>
180
- </div>
181
- </div>
182
-
183
- <div id="image-container">
184
- <img src="https://huggingface.co/spaces/tonyassi/storage/resolve/main/mudderfuger1.jpg" alt="Chat Header Image">
185
- </div>
186
-
187
- <div id="chat-container"></div>
188
- <div id="input-container">
189
- <input type="text" id="user-input" placeholder="Type your message...">
190
- <button onclick="sendMessage()">
191
- <img src="https://cdn-uploads.huggingface.co/production/uploads/648a824a8ca6cf9857d1349c/aJO71FyXi40-U_AOjwPmt.png" alt="Send">
192
- </button>
193
- </div>
194
-
195
- <div id="audio-recording-container">
196
- <button id="audio-record-button">START</button>
197
- </div>
198
-
199
- <script>
200
- function sendMessage() {
201
- var userInput = document.getElementById('user-input').value;
202
- if (userInput.trim() === "") return;
203
-
204
- var chatContainer = document.getElementById('chat-container');
205
-
206
- var userBubble = document.createElement('div');
207
- userBubble.textContent = userInput;
208
- userBubble.className = 'chat-bubble user-bubble';
209
- chatContainer.appendChild(userBubble);
210
-
211
- var botBubble = document.createElement('div');
212
- botBubble.textContent = ". . .";
213
- botBubble.className = 'chat-bubble bot-bubble';
214
- chatContainer.appendChild(botBubble);
215
-
216
- chatContainer.scrollTop = chatContainer.scrollHeight;
217
- document.getElementById('user-input').value = '';
218
-
219
- var xhr = new XMLHttpRequest();
220
- xhr.open('POST', '/send_message', true);
221
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
222
- xhr.onload = function () {
223
- if (xhr.status === 200) {
224
- var response = JSON.parse(xhr.responseText);
225
- botBubble.textContent = response.response;
226
- chatContainer.scrollTop = chatContainer.scrollHeight;
227
- }
228
- };
229
- xhr.send('user_input=' + encodeURIComponent(userInput));
230
- }
231
-
232
- document.getElementById('user-input').addEventListener('keydown', function(event) {
233
- if (event.key === 'Enter') {
234
- sendMessage();
235
- }
236
- });
237
-
238
- function toggleMenu() {
239
- var menuContent = document.getElementById('menu-content');
240
- menuContent.style.display = menuContent.style.display === 'block' ? 'none' : 'block';
241
- }
242
-
243
- function showTextChat() {
244
- document.getElementById('chat-container').style.display = 'flex';
245
- document.getElementById('input-container').style.display = 'flex';
246
- document.getElementById('audio-recording-container').style.display = 'none';
247
- document.getElementById('menu-content').style.display = 'none';
248
- }
249
-
250
- function showAudioChat() {
251
- document.getElementById('chat-container').style.display = 'none';
252
- document.getElementById('input-container').style.display = 'none';
253
- document.getElementById('audio-recording-container').style.display = 'flex';
254
- document.getElementById('menu-content').style.display = 'none';
255
- }
256
-
257
- let mediaRecorder;
258
- let audioChunks = [];
259
- const recordButton = document.getElementById('audio-record-button');
260
- let isRecording = false;
261
-
262
- recordButton.addEventListener('click', () => {
263
- if (isRecording) {
264
- mediaRecorder.stop();
265
- recordButton.textContent = 'START';
266
- recordButton.classList.remove('recording');
267
- } else {
268
- navigator.mediaDevices.getUserMedia({ audio: true })
269
- .then(stream => {
270
- mediaRecorder = new MediaRecorder(stream);
271
- mediaRecorder.start();
272
- mediaRecorder.addEventListener('dataavailable', event => {
273
- audioChunks.push(event.data);
274
- });
275
- mediaRecorder.addEventListener('stop', () => {
276
- const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });
277
- const formData = new FormData();
278
- formData.append('file', audioBlob, 'audio.wav');
279
- fetch('/upload', {
280
- method: 'POST',
281
- body: formData
282
- })
283
- .then(response => response.json())
284
- .catch(error => {
285
- console.error('Error:', error);
286
- });
287
- audioChunks = [];
288
- });
289
- recordButton.textContent = 'STOP';
290
- recordButton.classList.add('recording');
291
- });
292
- }
293
- isRecording = !isRecording;
294
- });
295
- </script>
296
- </body>
297
- </html>