Akjava commited on
Commit
c73126b
·
verified ·
1 Parent(s): fc47a3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -7,13 +7,6 @@ import json
7
  import subprocess
8
  import sys
9
  from llama_cpp import Llama,llama_model_decoder_start_token
10
- from llama_cpp_agent import LlamaCppAgent
11
- from llama_cpp_agent import MessagesFormatterType
12
- from llama_cpp_agent.providers import LlamaCppPythonProvider
13
- from llama_cpp_agent.chat_history import BasicChatHistory
14
- from llama_cpp_agent.chat_history.messages import Roles
15
- from llama_cpp_agent.chat_history.messages import Roles
16
- from llama_cpp_agent.messages_formatter import MessagesFormatter, PromptMarkers
17
  import gradio as gr
18
  from huggingface_hub import hf_hub_download
19
  from typing import List, Tuple
@@ -77,6 +70,8 @@ def respond(
77
  Returns:
78
  str: The response to the message.
79
  """
 
 
80
  try:
81
  global llama
82
  if llama == None:
@@ -85,7 +80,7 @@ def respond(
85
  n_batch=16,
86
  n_ctx=512,
87
  n_threads=2,
88
- n_threads_batch=2,vrbose=False)
89
 
90
  tokens = llama.tokenize(f"<2ja>{message}".encode("utf-8"))
91
  llama.encode(tokens)
 
7
  import subprocess
8
  import sys
9
  from llama_cpp import Llama,llama_model_decoder_start_token
 
 
 
 
 
 
 
10
  import gradio as gr
11
  from huggingface_hub import hf_hub_download
12
  from typing import List, Tuple
 
70
  Returns:
71
  str: The response to the message.
72
  """
73
+ if model==None:
74
+ return
75
  try:
76
  global llama
77
  if llama == None:
 
80
  n_batch=16,
81
  n_ctx=512,
82
  n_threads=2,
83
+ n_threads_batch=2,verbose=False)
84
 
85
  tokens = llama.tokenize(f"<2ja>{message}".encode("utf-8"))
86
  llama.encode(tokens)