nroggendorff commited on
Commit
f6ced6f
1 Parent(s): 1e2eab9

Delete public

Browse files
Files changed (3) hide show
  1. public/client.js +0 -33
  2. public/index.html +0 -21
  3. public/style.css +0 -60
public/client.js DELETED
@@ -1,33 +0,0 @@
1
- // import { Client } from "@gradio/client";
2
- import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
3
-
4
- document.addEventListener("DOMContentLoaded", async () => {
5
- const messagesDiv = document.getElementById("messages");
6
- const chatForm = document.getElementById("chat-form");
7
- const userInput = document.getElementById("user-input");
8
-
9
- const client = await Client.connect("nroggendorff/not-my-emma");
10
-
11
- chatForm.addEventListener("submit", async (e) => {
12
- e.preventDefault();
13
- const userMessage = userInput.value;
14
- if (!userMessage) return;
15
-
16
- addMessage(userMessage, "user");
17
-
18
- const result = await client.predict("/chat", {
19
- message: userMessage
20
- });
21
-
22
- addMessage(result.data, "ai");
23
- userInput.value = "";
24
- });
25
-
26
- function addMessage(message, sender) {
27
- const messageElement = document.createElement("div");
28
- messageElement.classList.add("message", sender);
29
- messageElement.textContent = message;
30
- messagesDiv.appendChild(messageElement);
31
- messagesDiv.scrollTop = messagesDiv.scrollHeight;
32
- }
33
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/index.html DELETED
@@ -1,21 +0,0 @@
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>Chat UI</title>
7
- <link rel="stylesheet" href="./style.css">
8
- </head>
9
- <body>
10
- <div id="app">
11
- <div class="chat-container">
12
- <div id="messages" class="messages"></div>
13
- <form id="chat-form">
14
- <input type="text" id="user-input" placeholder="Ask anything.." autocomplete="off" required />
15
- <button type="submit">Send</button>
16
- </form>
17
- </div>
18
- </div>
19
- <script type="module" src="./client.js"></script>
20
- </body>
21
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/style.css DELETED
@@ -1,60 +0,0 @@
1
- body {
2
- display: flex;
3
- justify-content: center;
4
- align-items: center;
5
- min-height: 100vh;
6
- margin: 0;
7
- font-family: Arial, sans-serif;
8
- background-color: #f4f6f8;
9
- }
10
-
11
- .chat-container {
12
- width: 100%;
13
- max-width: 400px;
14
- border-radius: 8px;
15
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
16
- overflow: hidden;
17
- display: flex;
18
- flex-direction: column;
19
- background-color: white;
20
- }
21
-
22
- .messages {
23
- flex-grow: 1;
24
- padding: 16px;
25
- overflow-y: auto;
26
- }
27
-
28
- .message {
29
- margin-bottom: 12px;
30
- }
31
-
32
- .message.user {
33
- text-align: right;
34
- color: #007bff;
35
- }
36
-
37
- .message.ai {
38
- text-align: left;
39
- color: #333;
40
- }
41
-
42
- #chat-form {
43
- display: flex;
44
- border-top: 1px solid #eee;
45
- }
46
-
47
- #user-input {
48
- flex-grow: 1;
49
- padding: 12px;
50
- border: none;
51
- border-top-left-radius: 8px;
52
- }
53
-
54
- button {
55
- padding: 12px;
56
- background-color: #007bff;
57
- color: white;
58
- border: none;
59
- cursor: pointer;
60
- }