Update app.py
Browse files
app.py
CHANGED
|
@@ -35,13 +35,16 @@ def greet_json():
|
|
| 35 |
}
|
| 36 |
.container {
|
| 37 |
margin-top: 60px;
|
| 38 |
-
width:
|
| 39 |
margin-bottom: 20px;
|
| 40 |
}
|
| 41 |
.system-prompt {
|
| 42 |
display: flex;
|
| 43 |
justify-content: space-between;
|
| 44 |
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
.system-prompt input {
|
| 47 |
width: 70%;
|
|
@@ -65,15 +68,16 @@ def greet_json():
|
|
| 65 |
border-radius: 8px;
|
| 66 |
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 67 |
padding: 20px;
|
| 68 |
-
height:
|
| 69 |
overflow-y: auto;
|
|
|
|
| 70 |
}
|
| 71 |
.message {
|
| 72 |
margin-bottom: 10px;
|
| 73 |
}
|
| 74 |
.user {
|
| 75 |
text-align: right;
|
| 76 |
-
color: #
|
| 77 |
}
|
| 78 |
.assistant {
|
| 79 |
text-align: left;
|
|
@@ -91,25 +95,32 @@ def greet_json():
|
|
| 91 |
border-radius: 4px;
|
| 92 |
margin-right: 10px;
|
| 93 |
}
|
| 94 |
-
.input-section input:focus {
|
| 95 |
-
outline: none;
|
| 96 |
-
border-color: #007bff;
|
| 97 |
-
}
|
| 98 |
.input-section button {
|
| 99 |
padding: 10px 20px;
|
| 100 |
border: none;
|
| 101 |
-
background-color: #
|
| 102 |
color: white;
|
| 103 |
border-radius: 4px;
|
| 104 |
cursor: pointer;
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
.input-section button:hover {
|
| 107 |
-
background-color: #
|
| 108 |
}
|
| 109 |
.token-input {
|
| 110 |
-
width:
|
| 111 |
margin-left: 10px;
|
| 112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
</style>
|
| 114 |
</head>
|
| 115 |
<body>
|
|
@@ -119,8 +130,9 @@ def greet_json():
|
|
| 119 |
<button onclick="setSystemPromptAndClearHistory()">Set prompt and clear history</button>
|
| 120 |
</div>
|
| 121 |
<div class="chatbox" id="chatbox"></div>
|
|
|
|
|
|
|
| 122 |
<div class="input-section">
|
| 123 |
-
<input type="text" id="userInput" placeholder="Type your message here...">
|
| 124 |
<input type="number" id="tokenLength" class="token-input" value="50" placeholder="Tokens">
|
| 125 |
<button onclick="sendMessage()">Send</button>
|
| 126 |
</div>
|
|
@@ -186,7 +198,7 @@ def greet_json():
|
|
| 186 |
llm = Llama.from_pretrained(
|
| 187 |
repo_id="Qwen/Qwen2.5-1.5B-Instruct-GGUF",
|
| 188 |
filename="qwen2.5-1.5b-instruct-q8_0.gguf",
|
| 189 |
-
verbose=
|
| 190 |
)
|
| 191 |
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
|
| 192 |
|
|
|
|
| 35 |
}
|
| 36 |
.container {
|
| 37 |
margin-top: 60px;
|
| 38 |
+
width: 80%;
|
| 39 |
margin-bottom: 20px;
|
| 40 |
}
|
| 41 |
.system-prompt {
|
| 42 |
display: flex;
|
| 43 |
justify-content: space-between;
|
| 44 |
margin-bottom: 20px;
|
| 45 |
+
padding: 16px;
|
| 46 |
+
border: 1px solid #ccc;
|
| 47 |
+
border-radius: 4px;
|
| 48 |
}
|
| 49 |
.system-prompt input {
|
| 50 |
width: 70%;
|
|
|
|
| 68 |
border-radius: 8px;
|
| 69 |
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 70 |
padding: 20px;
|
| 71 |
+
height: 300px;
|
| 72 |
overflow-y: auto;
|
| 73 |
+
border: 1px solid #ccc;
|
| 74 |
}
|
| 75 |
.message {
|
| 76 |
margin-bottom: 10px;
|
| 77 |
}
|
| 78 |
.user {
|
| 79 |
text-align: right;
|
| 80 |
+
color: #050505;
|
| 81 |
}
|
| 82 |
.assistant {
|
| 83 |
text-align: left;
|
|
|
|
| 95 |
border-radius: 4px;
|
| 96 |
margin-right: 10px;
|
| 97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
.input-section button {
|
| 99 |
padding: 10px 20px;
|
| 100 |
border: none;
|
| 101 |
+
background-color: #283fa7;
|
| 102 |
color: white;
|
| 103 |
border-radius: 4px;
|
| 104 |
cursor: pointer;
|
| 105 |
+
margin-left: 50%;
|
| 106 |
+
width: 150px;
|
| 107 |
}
|
| 108 |
.input-section button:hover {
|
| 109 |
+
background-color: #112388;
|
| 110 |
}
|
| 111 |
.token-input {
|
| 112 |
+
width: 25px;
|
| 113 |
margin-left: 10px;
|
| 114 |
}
|
| 115 |
+
#userInput{
|
| 116 |
+
height: 100px;
|
| 117 |
+
width: 100%;
|
| 118 |
+
margin-top: 6px;
|
| 119 |
+
}
|
| 120 |
+
#userInput:focus {
|
| 121 |
+
outline: none;
|
| 122 |
+
border-color: #007bff;
|
| 123 |
+
}
|
| 124 |
</style>
|
| 125 |
</head>
|
| 126 |
<body>
|
|
|
|
| 130 |
<button onclick="setSystemPromptAndClearHistory()">Set prompt and clear history</button>
|
| 131 |
</div>
|
| 132 |
<div class="chatbox" id="chatbox"></div>
|
| 133 |
+
<textarea type="text" id="userInput" placeholder="Type your message here..."></textarea>
|
| 134 |
+
|
| 135 |
<div class="input-section">
|
|
|
|
| 136 |
<input type="number" id="tokenLength" class="token-input" value="50" placeholder="Tokens">
|
| 137 |
<button onclick="sendMessage()">Send</button>
|
| 138 |
</div>
|
|
|
|
| 198 |
llm = Llama.from_pretrained(
|
| 199 |
repo_id="Qwen/Qwen2.5-1.5B-Instruct-GGUF",
|
| 200 |
filename="qwen2.5-1.5b-instruct-q8_0.gguf",
|
| 201 |
+
verbose=True,n_ctx=2048
|
| 202 |
)
|
| 203 |
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
|
| 204 |
|