Wizz13150 commited on
Commit
71cfd62
·
1 Parent(s): 2adbada

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import random
 
3
  from llama_cpp import Llama
4
 
5
  # Liste des modèles disponibles
@@ -16,15 +17,16 @@ model_versions = {
16
  llm = None
17
  current_model = "WizzGPTv7"
18
 
19
- def load_model(model_name):
20
- global llm, current_model
21
- current_model = model_name
22
- llm = Llama(
23
- model_path=model_versions[model_name],
24
- n_threads=2,
25
- n_ctx=1024,
26
- use_mlock=True
27
- )
 
28
 
29
  # Charger modèle initial
30
  load_model(current_model)
 
1
  import gradio as gr
2
  import random
3
+ import os
4
  from llama_cpp import Llama
5
 
6
  # Liste des modèles disponibles
 
17
  llm = None
18
  current_model = "WizzGPTv7"
19
 
20
+ model_path = os.path.join("model", model_name)
21
+ if not os.path.exists(model_path):
22
+ raise FileNotFoundError(f"Model file not found at {model_path}")
23
+ llm = Llama(
24
+ model_path=model_path,
25
+ n_ctx=2048,
26
+ n_threads=2,
27
+ n_batch=32,
28
+ verbose=False
29
+ )
30
 
31
  # Charger modèle initial
32
  load_model(current_model)