sujal7102003 commited on
Commit
b089eec
·
verified ·
1 Parent(s): dfedfee

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. templates/index.html +83 -0
templates/index.html CHANGED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TinyLlama Chat</title>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ padding: 2rem;
9
+ background-color: #f2f2f2;
10
+ }
11
+ .container {
12
+ background-color: white;
13
+ padding: 2rem;
14
+ border-radius: 10px;
15
+ max-width: 600px;
16
+ margin: auto;
17
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
18
+ }
19
+ textarea {
20
+ width: 100%;
21
+ padding: 1rem;
22
+ border-radius: 8px;
23
+ border: 1px solid #ccc;
24
+ font-size: 16px;
25
+ margin-top: 0.5rem;
26
+ height: 120px;
27
+ resize: none;
28
+ }
29
+ button {
30
+ margin-top: 1rem;
31
+ padding: 0.5rem 1.5rem;
32
+ background-color: #007bff;
33
+ color: white;
34
+ font-size: 16px;
35
+ border: none;
36
+ border-radius: 6px;
37
+ cursor: pointer;
38
+ }
39
+ .response-box {
40
+ margin-top: 2rem;
41
+ padding: 1rem;
42
+ background-color: #e8f0fe;
43
+ border-radius: 6px;
44
+ min-height: 100px;
45
+ }
46
+ </style>
47
+ </head>
48
+ <body>
49
+ <div class="container">
50
+ <h2>TinyLlama QLoRA Q/A System</h2>
51
+ <form id="query-form">
52
+ <label for="prompt">Enter your prompt:</label>
53
+ <textarea id="prompt" name="prompt" required></textarea>
54
+ <button type="submit">Submit</button>
55
+ </form>
56
+
57
+ <div class="response-box" id="response-box">
58
+ <strong>Response:</strong>
59
+ <p id="response-text">Waiting for input...</p>
60
+ </div>
61
+ </div>
62
+
63
+ <script>
64
+ const form = document.getElementById('query-form');
65
+ const responseText = document.getElementById('response-text');
66
+
67
+ form.addEventListener('submit', async function (e) {
68
+ e.preventDefault();
69
+
70
+ const prompt = document.getElementById('prompt').value;
71
+
72
+ const response = await fetch('/predict/qlora', {
73
+ method: 'POST',
74
+ headers: { 'Content-Type': 'application/json' },
75
+ body: JSON.stringify({ prompt })
76
+ });
77
+
78
+ const data = await response.json();
79
+ responseText.innerText = data.response || "No response received.";
80
+ });
81
+ </script>
82
+ </body>
83
+ </html>