Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,18 @@
|
|
|
|
1 |
from gpt4all import GPT4All
|
2 |
from huggingface_hub import hf_hub_download
|
3 |
|
4 |
-
title = "Mistral-7B-Instruct-GGUF-HOTRSS Run On CPU-Basic Free Hardware"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
from gpt4all import GPT4All
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
+
title = "Mistral-7B-Instruct-GGUF-HOTRSS Run On CPU-Basic Free Hardware"
|
6 |
+
|
7 |
+
max_new_tokens = 2048
|
8 |
+
|
9 |
+
def generater(message, history, temperature, top_p, top_k):
|
10 |
+
prompt = "<s>"
|
11 |
+
for user_message, assistant_message in history:
|
12 |
+
prompt += model.config["promptTemplate"].format(user_message)
|
13 |
+
prompt += assistant_message + "</s>"
|
14 |
+
prompt += model.config["promptTemplate"].format(message)
|
15 |
+
outputs = []
|
16 |
+
for token in model.generate(prompt=prompt, temp=temperature, top_k = top_k, top_p = top_p, max_tokens = max_new_tokens, streaming=True):
|
17 |
+
outputs.append(token)
|
18 |
+
yield "".join(outputs)
|