Spaces:
Sleeping
Sleeping
Delete chat.html
Browse files
chat.html
DELETED
|
@@ -1,132 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<title>Chat with Model</title>
|
| 6 |
-
<style>
|
| 7 |
-
body {
|
| 8 |
-
font-family: Arial, sans-serif;
|
| 9 |
-
background-color: #f4f7fa;
|
| 10 |
-
color: #333;
|
| 11 |
-
display: flex;
|
| 12 |
-
justify-content: center;
|
| 13 |
-
align-items: center;
|
| 14 |
-
height: 100vh;
|
| 15 |
-
margin: 0;
|
| 16 |
-
}
|
| 17 |
-
.container {
|
| 18 |
-
width: 100%;
|
| 19 |
-
max-width: 600px;
|
| 20 |
-
background: white;
|
| 21 |
-
border-radius: 10px;
|
| 22 |
-
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
|
| 23 |
-
overflow: hidden;
|
| 24 |
-
}
|
| 25 |
-
header {
|
| 26 |
-
background-color: #4a90e2;
|
| 27 |
-
color: white;
|
| 28 |
-
text-align: center;
|
| 29 |
-
padding: 20px;
|
| 30 |
-
}
|
| 31 |
-
header h1 {
|
| 32 |
-
margin: 0;
|
| 33 |
-
font-size: 24px;
|
| 34 |
-
}
|
| 35 |
-
header p {
|
| 36 |
-
margin: 5px 0 0;
|
| 37 |
-
font-size: 14px;
|
| 38 |
-
color: #d9e8f5;
|
| 39 |
-
}
|
| 40 |
-
.chat-window {
|
| 41 |
-
max-height: 400px;
|
| 42 |
-
overflow-y: auto;
|
| 43 |
-
padding: 15px;
|
| 44 |
-
}
|
| 45 |
-
.chat-controls {
|
| 46 |
-
display: flex;
|
| 47 |
-
padding: 10px;
|
| 48 |
-
border-top: 1px solid #e1e1e1;
|
| 49 |
-
background-color: #f9f9f9;
|
| 50 |
-
}
|
| 51 |
-
.chat-input {
|
| 52 |
-
flex: 1;
|
| 53 |
-
padding: 10px;
|
| 54 |
-
font-size: 16px;
|
| 55 |
-
border: 1px solid #ccc;
|
| 56 |
-
border-radius: 5px;
|
| 57 |
-
margin-right: 10px;
|
| 58 |
-
}
|
| 59 |
-
.send-button {
|
| 60 |
-
padding: 10px 15px;
|
| 61 |
-
font-size: 16px;
|
| 62 |
-
color: white;
|
| 63 |
-
background-color: #4a90e2;
|
| 64 |
-
border: none;
|
| 65 |
-
border-radius: 5px;
|
| 66 |
-
cursor: pointer;
|
| 67 |
-
}
|
| 68 |
-
.send-button:hover {
|
| 69 |
-
background-color: #357ab8;
|
| 70 |
-
}
|
| 71 |
-
.message {
|
| 72 |
-
padding: 10px;
|
| 73 |
-
margin: 8px 0;
|
| 74 |
-
border-radius: 10px;
|
| 75 |
-
font-size: 16px;
|
| 76 |
-
width: fit-content;
|
| 77 |
-
max-width: 75%;
|
| 78 |
-
}
|
| 79 |
-
.message.user {
|
| 80 |
-
background-color: #e1f5fe;
|
| 81 |
-
align-self: flex-end;
|
| 82 |
-
text-align: right;
|
| 83 |
-
}
|
| 84 |
-
.message.model {
|
| 85 |
-
background-color: #f0f0f0;
|
| 86 |
-
align-self: flex-start;
|
| 87 |
-
text-align: left;
|
| 88 |
-
}
|
| 89 |
-
</style>
|
| 90 |
-
<script>
|
| 91 |
-
async function sendPrompt(modelName) {
|
| 92 |
-
const prompt = document.getElementById("prompt").value;
|
| 93 |
-
|
| 94 |
-
if (!prompt.trim()) {
|
| 95 |
-
alert("Please enter a message.");
|
| 96 |
-
return;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
const response = await fetch(`/generate/${modelName}`, {
|
| 100 |
-
method: "POST",
|
| 101 |
-
headers: { "Content-Type": "application/json" },
|
| 102 |
-
body: JSON.stringify({ prompt })
|
| 103 |
-
});
|
| 104 |
-
|
| 105 |
-
const data = await response.json();
|
| 106 |
-
const chatWindow = document.getElementById("chat-window");
|
| 107 |
-
|
| 108 |
-
chatWindow.innerHTML += `<p><b>You:</b> ${prompt}</p>`;
|
| 109 |
-
chatWindow.innerHTML += `<p><b>${modelName}:</b> ${data.response}</p>`;
|
| 110 |
-
|
| 111 |
-
chatWindow.scrollTop = chatWindow.scrollHeight;
|
| 112 |
-
document.getElementById("prompt").value = "";
|
| 113 |
-
}
|
| 114 |
-
</script>
|
| 115 |
-
|
| 116 |
-
</head>
|
| 117 |
-
<body>
|
| 118 |
-
<div class="container">
|
| 119 |
-
<header>
|
| 120 |
-
<h1>Interactive NLP Model Chat</h1>
|
| 121 |
-
<p>Ask questions, get insights, and explore the capabilities of your custom model.</p>
|
| 122 |
-
</header>
|
| 123 |
-
<main id="chat-window" class="chat-window">
|
| 124 |
-
<!-- Messages will appear here -->
|
| 125 |
-
</main>
|
| 126 |
-
<footer class="chat-controls">
|
| 127 |
-
<input id="prompt" class="chat-input" type="text" placeholder="Type your question..." autocomplete="off">
|
| 128 |
-
<button onclick="sendPrompt('{{ model_name }}')">Send</button>
|
| 129 |
-
</footer>
|
| 130 |
-
</div>
|
| 131 |
-
</body>
|
| 132 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|