pabloce commited on
Commit
40afde6
·
verified ·
1 Parent(s): ccb29ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -2,18 +2,15 @@ import spaces
2
  import subprocess
3
  import gradio as gr
4
  from huggingface_hub import hf_hub_download
5
- from llama_cpp import Llama
6
- from llama_cpp_agent import LlamaCppAgent
7
- from llama_cpp_agent import MessagesFormatterType
8
- from llama_cpp_agent.providers import LlamaCppPythonProvider
9
 
10
- from llama_index.core.llms import ChatMessage, MessageRole
11
- from llama_index.llms.llama_cpp import LlamaCPP
12
- from llama_index.llms.llama_cpp.llama_utils import (
13
- messages_to_prompt,
14
- completion_to_prompt,
15
- )
16
- from llama_index.core.memory import ChatMemoryBuffer
 
17
 
18
  subprocess.run('pip install llama-cpp-python==0.2.75 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124', shell=True)
19
  subprocess.run('pip install llama-cpp-agent', shell=True)
@@ -29,6 +26,11 @@ def respond(
29
  temperature,
30
  top_p,
31
  ):
 
 
 
 
 
32
  llama_model = Llama(r"models/mistral-7b-instruct-v0.2.Q6_K.gguf", n_batch=1024, n_threads=0, n_gpu_layers=33, n_ctx=8192, verbose=False)
33
 
34
  provider = LlamaCppPythonProvider(llama_model)
 
2
  import subprocess
3
  import gradio as gr
4
  from huggingface_hub import hf_hub_download
 
 
 
 
5
 
6
+
7
+ # from llama_index.core.llms import ChatMessage, MessageRole
8
+ # from llama_index.llms.llama_cpp import LlamaCPP
9
+ # from llama_index.llms.llama_cpp.llama_utils import (
10
+ # messages_to_prompt,
11
+ # completion_to_prompt,
12
+ # )
13
+ # from llama_index.core.memory import ChatMemoryBuffer
14
 
15
  subprocess.run('pip install llama-cpp-python==0.2.75 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124', shell=True)
16
  subprocess.run('pip install llama-cpp-agent', shell=True)
 
26
  temperature,
27
  top_p,
28
  ):
29
+ from llama_cpp import Llama
30
+ from llama_cpp_agent import LlamaCppAgent
31
+ from llama_cpp_agent import MessagesFormatterType
32
+ from llama_cpp_agent.providers import LlamaCppPythonProvider
33
+
34
  llama_model = Llama(r"models/mistral-7b-instruct-v0.2.Q6_K.gguf", n_batch=1024, n_threads=0, n_gpu_layers=33, n_ctx=8192, verbose=False)
35
 
36
  provider = LlamaCppPythonProvider(llama_model)