Invescoz commited on
Commit
468090f
·
verified ·
1 Parent(s): 6f5e1f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1,7 +1,16 @@
1
  import gradio as gr
2
- from llama_cpp import Llama
3
- from typing import Generator
4
  import os
 
 
 
 
 
 
 
 
 
5
 
6
  # Initialize model
7
  model_path = "AstroSage-8B-BF16.gguf" # Downloaded from AstroMLab/AstroSage-8B-GGUF
 
1
  import gradio as gr
2
+ import subprocess
3
+ import sys
4
  import os
5
+ from typing import Generator
6
+
7
+ # Install llama-cpp-python at runtime if not found
8
+ try:
9
+ from llama_cpp import Llama
10
+ except ImportError:
11
+ print("Installing llama-cpp-python...")
12
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "llama-cpp-python==0.2.85"])
13
+ from llama_cpp import Llama
14
 
15
  # Initialize model
16
  model_path = "AstroSage-8B-BF16.gguf" # Downloaded from AstroMLab/AstroSage-8B-GGUF