Download index.html from Dude-321/ChatPDF: direct link, hf CLI and curl.
- Browser
- Download file 15.1 kB
-
https://huggingface.co/spaces/Dude-321/ChatPDF/resolve/main/index.html
- Command line
-
hf download hf://spaces/Dude-321/ChatPDF/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Dude-321/ChatPDF/resolve/main/index.html
15.1 kB
| <html lang="en" class="has-navbar-fixed-top has-navbar-fixed-bottom"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css"> | |
| <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
| <title>914IA</title> | |
| <style> | |
| /* Loading Animation Styles */ | |
| .loader { | |
| border: 8px solid #f3f3f3; /* Light grey */ | |
| border-top: 8px solid #3498db; /* Blue */ | |
| border-radius: 50%; | |
| width: 50px; | |
| height: 50px; | |
| animation: spin 1s linear infinite; | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| z-index: 1000; /* Ensure it is on top of other content */ | |
| display: none; /* Hidden by default */ | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| .textarea { | |
| field-sizing: content; | |
| max-width: 25rem; | |
| max-height: 25rem; | |
| display: flex; | |
| align-items: center; /* Centers items vertically */ | |
| justify-content: center; /* Centers items horizontally */ | |
| resize: none; | |
| border: none; | |
| outline: none; | |
| box-shadow: none; | |
| overflow: hidden; /* Hide scrollbar */ | |
| height: min-content; | |
| min-height: 0.1rem; | |
| min-width: 0.5rem; /*makes the buttons get inside the container*/ | |
| margin: none; /* Remove margin */ | |
| flex-direction: row; /* Aligns children in a row */ | |
| } | |
| .textarea-container { | |
| display: flex; | |
| align-items: center; /* Aligns items vertically in the center */ | |
| justify-content: center; /* Centers items horizontally */ | |
| border: 5px solid #dbdbdb; | |
| border-radius: 20px; | |
| padding: 0.5rem; | |
| background-color: white; | |
| width: 30rem; /* Adjust width as needed */ | |
| flex-direction: row; /* Aligns children in a row */ | |
| } | |
| .buttons-container { | |
| display: flex; /* Aligns buttons horizontally */ | |
| } | |
| .icon-button { | |
| background: none; | |
| border: none; | |
| cursor: pointer; | |
| margin-left: 0.5rem; /* Space between buttons */ | |
| } | |
| .custom-margin { | |
| margin-left: 10px; /* Adjust as needed */ | |
| margin-right: 10px; /* Adjust as needed */ | |
| } | |
| .no-border { | |
| border: none; | |
| outline: none; | |
| } | |
| button:active, button:focus { | |
| outline: none; | |
| box-shadow: none; | |
| } | |
| .card-footer { | |
| border-top: none; | |
| } | |
| .centered-input { | |
| display: flex; | |
| justify-content: center; | |
| width: 100%; | |
| } | |
| .centered-input-container { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| width: 100%; | |
| padding: 10px 0; | |
| } | |
| .input-with-icons { | |
| display: flex; | |
| align-items: center; | |
| width: 100%; | |
| max-width: 600px; | |
| margin: auto; | |
| border: 3px solid #000000; /* Match Bulma's default input border */ | |
| border-radius: 20px; /* Rounded corners */ | |
| overflow: hidden; /* Ensures rounded corners encompass the whole component */ | |
| background-color: #fff; /* Background color matching Bulma's input */ | |
| } | |
| .input-with-icons input { | |
| flex-grow: 1; | |
| border: none; | |
| box-shadow: none; | |
| outline: none; | |
| padding-left: 5px; | |
| transition: background-color 0.3s; /* Smooth transition for focus effect */ | |
| } | |
| .icon-button { | |
| background-color: transparent; | |
| border: none; | |
| cursor: pointer; | |
| padding: 0 10px; | |
| } | |
| .input-with-icons input { | |
| flex-grow: 1; | |
| border: none; /* Removes input border */ | |
| outline: none; /* Removes focus outline */ | |
| box-shadow: none; /* Removes box-shadow */ | |
| padding-left: 5px; | |
| background-color: inherit; /* Matches container background */ | |
| } | |
| .input-with-icons input:focus { | |
| outline: none; /* Removes the outline */ | |
| box-shadow: none; /* Removes any box-shadow */ | |
| border: none; /* Ensures no border appears */ | |
| } | |
| .card { | |
| border-radius: 20px; /* Adjusts the roundness of the corners */ | |
| } | |
| :root { | |
| --bulma-scheme-main: #fff; | |
| /* Define other light mode variables */ | |
| } | |
| :root.dark { | |
| --bulma-scheme-main: #000; | |
| /* Define other dark mode variables */ | |
| } | |
| </style> | |
| </head> | |
| <body > | |
| <!-- Fixed Menu and Title --> | |
| <nav class="navbar is-fixed-top" style="margin: 0.5rem;" role="navigation" aria-label="main navigation"> | |
| <div class="navbar-brand" > | |
| <!-- Hamburger Menu on the Left --> | |
| <a role="button" class="navbar-burger ml-0 burger" aria-label="menu" aria-expanded="false" onclick="toggleMenu()"> | |
| <span aria-hidden="true"></span> | |
| <span aria-hidden="true"></span> | |
| <span aria-hidden="true"></span> | |
| </a> | |
| <!-- Brand Title --> | |
| <span class="navbar-item"> | |
| 914IA | |
| </span> | |
| </div> | |
| <!-- Navigation Menu Items --> | |
| <div id="navbarBasicExample" class="navbar-menu"> | |
| <div class="navbar-start"> | |
| <a class="navbar-item">Home</a> | |
| <!-- <a class="navbar-item">Documentation</a> | |
| <a class="navbar-item">Examples</a> --> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- End of Fixed Menu and Title --> | |
| <!-- Main Content --> | |
| <div class="container px-4" style="padding-top: 60px; padding-bottom: 50px; min-width: 3rem; margin-bottom: 3rem;"> | |
| <!-- List of Messages --> | |
| <div id="messageList" class="columns is-multiline"> | |
| <div class="column is-full"> | |
| <!-- message --> | |
| <div class="card"> | |
| <div class="card-content mb-3 "> | |
| <h2 class="title is-4">This is a scaled down version of efexzium. </h2> | |
| <p>If you want the full powerful AI chat PDF solutions please contact john@efexzium.com we will repply 24/7 we are here to help you. </p> | |
| <br> | |
| <p><b>John@efexzium.com</b> - <i>CEO of efexzium</i></p> | |
| <br> | |
| <footer class="card-footer"> | |
| <div style="display: flex; align-items: center;"> | |
| <!-- Clipboard Icon --> | |
| <button class="button is-small no-border no-outline mr-2"> | |
| <span class="icon is-small"> | |
| <i class="fas fa-clipboard"></i> | |
| </span> | |
| </button> | |
| <!-- Like Icon --> | |
| <button class="button is-small no-border no-outline mr-2"> | |
| <span class="icon is-small"> | |
| <i class="fas fa-thumbs-up"></i> | |
| </span> | |
| </button> | |
| <!-- Dislike Icon --> | |
| <button class="button is-small no-border no-outline"> | |
| <span class="icon is-small"> | |
| <i class="fas fa-thumbs-down"></i> | |
| </span> | |
| </button> | |
| </div> | |
| </footer> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="loader" id="loadingSpinner" class="columns"></div> | |
| <div style="display: flex; flex-direction: column;"> | |
| <!-- Fixed Footer with Auto-Growing Textarea and Buttons --> | |
| <nav class="column is-half is-offset-by-three-quarters is-flex is-justify-content-center is-align-items-center is-fixed-bottom columns is-vcentered" style="display: flex; background-color: transparent; justify-content: center; align-items: center; bottom: 0; " > | |
| <div class="container px-4 centered-input-container" > | |
| <div class="field" > | |
| <div class="textarea-container" style="width: fit-content; justify-content: center;" > | |
| <!-- oninput="autoResize(this)" --> | |
| <textarea class="textarea" id="messageInput" placeholder="Type a message..." oninput="autoResize(this)" rows="1" style="min-width: 0.5rem !important; width: 60vw !important; min-height: 1rem;" ></textarea> | |
| <div class="buttons-container"> | |
| <!-- Upload Icon Button --> | |
| <input type="file" id="fileInput" style="display:none;" /> | |
| <button class="icon-button" onclick="triggerFileInput()"> | |
| <i class="fas fa-upload"></i> | |
| </button> | |
| <!-- Send Message Icon Button --> | |
| <button id="sendMessageButton" class="icon-button"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| </div> | |
| <script> | |
| function triggerFileInput() { | |
| // Get the file input element | |
| var fileInput = document.getElementById('fileInput'); | |
| // Trigger the click event on the file input | |
| fileInput.click(); | |
| } | |
| // Listen for changes on the file input | |
| document.getElementById('fileInput').onchange = function(e) { | |
| var file = e.target.files[0]; | |
| console.log(file); // Do something with the selected file here | |
| }; | |
| let messages = []; // Array to hold messages | |
| function showLoader() { | |
| document.getElementById('loadingSpinner').style.display = 'block'; | |
| } | |
| function hideLoader() { | |
| document.getElementById('loadingSpinner').style.display = 'none'; | |
| } | |
| // Add event listener to the Send Message button | |
| document.getElementById('sendMessageButton').addEventListener('click', sendMessage); | |
| function renderMessages() { | |
| const messageList = document.getElementById('messageList'); | |
| messageList.innerHTML = ''; // Clear existing messages | |
| messages.forEach((msg) => { | |
| const messageCard = document.createElement('div'); | |
| messageCard.className = 'column is-full'; | |
| messageCard.innerHTML = ` | |
| <div class="card"> | |
| <div class="card-content mb-3"> | |
| <h2 class="title is-4">${msg.role === 'user' ? 'You' : 'AI'}</h2> | |
| <div class="content">${marked.parse(msg.content)}</div> | |
| </div> | |
| </div> | |
| `; | |
| messageList.appendChild(messageCard); | |
| }); | |
| } | |
| function sendMessage() { | |
| var textarea = document.getElementById('messageInput'); | |
| var messageContent = textarea.value; | |
| if (!messageContent.trim()) return; // Avoid sending empty messages | |
| showLoader(); // Show loader | |
| // Add user message to messages array | |
| messages.push({ role: 'user', content: messageContent }); | |
| renderMessages(); // Update the message list UI | |
| var xhr = new XMLHttpRequest(); | |
| var url = "https://openrouter.ai/api/v1/chat/completions"; | |
| xhr.open("POST", url, true); | |
| xhr.setRequestHeader("Authorization", "Bearer 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"); | |
| xhr.setRequestHeader("HTTP-Referer", "YOUR_SITE_URL"); // Optional | |
| xhr.setRequestHeader("X-Title", "YOUR_SITE_NAME"); // Optional | |
| xhr.setRequestHeader("Content-Type", "application/json"); | |
| var data = JSON.stringify({ | |
| "model": "meta-llama/llama-3.1-8b-instruct:free", | |
| "messages": messages // Send all messages | |
| }); | |
| xhr.onreadystatechange = function() { | |
| if (xhr.readyState === 4) { // Request is complete | |
| hideLoader(); // Hide loader when done | |
| if (xhr.status === 200) { // Success | |
| const response = JSON.parse(xhr.responseText); | |
| const aiMessage = response.choices[0].message.content; // Adjust this based on your API response | |
| // Add AI response to messages array | |
| messages.push({ role: 'ai', content: aiMessage }); | |
| renderMessages(); // Update the message list UI | |
| textarea.value = ''; // Clear the textarea after sending | |
| autoResize(textarea); // Adjust textarea height | |
| } else { | |
| // Handle errors | |
| const errorResponse = JSON.parse(xhr.responseText); | |
| const errorMessage = errorResponse.error ? errorResponse.error.message : "An unexpected error occurred"; | |
| // Add error message to messages array | |
| messages.push({ role: 'error', content: errorMessage }); | |
| renderMessages(); // Update the message list UI | |
| hideLoader(); // Hide loader when done | |
| console.error("Error:", xhr.status, xhr.statusText, errorMessage); | |
| } | |
| } | |
| }; | |
| xhr.send(data); | |
| } | |
| function toggleMenu() { | |
| var navbar = document.getElementById('navbarBasicExample'); | |
| navbar.classList.toggle('is-active'); | |
| } | |
| function autoResize(textarea) { | |
| const measureDiv = document.querySelector('.textarea-measure'); | |
| measureDiv.innerText = textarea.value + '\n'; // Add content to the measure div | |
| textarea.style.height = 'auto'; // Reset height to auto | |
| textarea.style.height = measureDiv.offsetHeight + 'px'; // Set textarea height to match measure div | |
| } | |
| // Initialize textarea height on page load | |
| window.onload = function() { | |
| const textarea = document.querySelector('.textarea'); | |
| autoResize(textarea); // Adjust based on content | |
| textarea.addEventListener('input', () => autoResize(textarea)); // Adjust on input | |
| }; | |
| </script> | |
| </body> | |
| </html> | |