bkoz commited on
Commit
33ba22e
·
unverified ·
1 Parent(s): dc28d56

added model download

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -19,10 +19,11 @@ def download_model():
19
  print(f'Downloading model {REPO_ID}/{FILENAME}')
20
  m = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
21
  print(f'status: {m}')
 
22
 
23
- def load_model():
24
  from llama_cpp import Llama, LlamaGrammar
25
- model_file="llama-2-7b.Q5_K_S.gguf"
26
  llm = Llama(
27
  model_path=model_file,
28
  n_gpu_layers=-1, verbose=False
@@ -58,8 +59,8 @@ def load_model():
58
  print(output['choices'][0]['text'])
59
  print()
60
 
61
- download_model()
62
- load_model()
63
  demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
64
  demo.launch(share=False)
65
 
 
19
  print(f'Downloading model {REPO_ID}/{FILENAME}')
20
  m = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
21
  print(f'status: {m}')
22
+ return m
23
 
24
+ def load_model(fp):
25
  from llama_cpp import Llama, LlamaGrammar
26
+ model_file=fp
27
  llm = Llama(
28
  model_path=model_file,
29
  n_gpu_layers=-1, verbose=False
 
59
  print(output['choices'][0]['text'])
60
  print()
61
 
62
+
63
+ load_model(download_model())
64
  demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
65
  demo.launch(share=False)
66