Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ model_name = model_id.split('/')[-1]
|
|
13 |
title = f"🇩🇪 {model_name}"
|
14 |
description = f"Chat with <a href=\"https://huggingface.co/{model_id}\">{model_name}</a> in GGUF format ({quant})!"
|
15 |
|
|
|
16 |
# Initialize the LLM
|
17 |
llm = Llama(model_path="model.gguf",
|
18 |
n_ctx=32768,
|
@@ -20,7 +21,7 @@ llm = Llama(model_path="model.gguf",
|
|
20 |
chat_format=chat_template)
|
21 |
|
22 |
# Function for streaming chat completions
|
23 |
-
def chat_stream_completion(message, history
|
24 |
#messages_prompts = [{"role": "system", "content": system_prompt}]
|
25 |
messages_prompts = []
|
26 |
for human, assistant in history:
|
@@ -39,6 +40,7 @@ def chat_stream_completion(message, history, system_prompt):
|
|
39 |
message_repl = message_repl + chunk['choices'][0]["delta"]["content"]
|
40 |
yield message_repl
|
41 |
|
|
|
42 |
# Gradio chat interface
|
43 |
gr.ChatInterface(
|
44 |
fn=chat_stream_completion,
|
|
|
13 |
title = f"🇩🇪 {model_name}"
|
14 |
description = f"Chat with <a href=\"https://huggingface.co/{model_id}\">{model_name}</a> in GGUF format ({quant})!"
|
15 |
|
16 |
+
print("loading model")
|
17 |
# Initialize the LLM
|
18 |
llm = Llama(model_path="model.gguf",
|
19 |
n_ctx=32768,
|
|
|
21 |
chat_format=chat_template)
|
22 |
|
23 |
# Function for streaming chat completions
|
24 |
+
def chat_stream_completion(message, history):
|
25 |
#messages_prompts = [{"role": "system", "content": system_prompt}]
|
26 |
messages_prompts = []
|
27 |
for human, assistant in history:
|
|
|
40 |
message_repl = message_repl + chunk['choices'][0]["delta"]["content"]
|
41 |
yield message_repl
|
42 |
|
43 |
+
print("starting gradio")
|
44 |
# Gradio chat interface
|
45 |
gr.ChatInterface(
|
46 |
fn=chat_stream_completion,
|