OttoCapi commited on
Commit
563c4a2
·
verified ·
1 Parent(s): eb03b27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from llama_cpp import Llama
3
  from deep_translator import GoogleTranslator
 
1
+ import subprocess
2
+ import sys
3
+
4
+ # Self-install dependencies if missing
5
+ REQUIRED = ["gradio==4.44.1", "deep-translator==1.11.4", "llama-cpp-python==0.2.90"]
6
+ for pkg in REQUIRED:
7
+ try:
8
+ __import__(pkg.split("==")[0])
9
+ except ImportError:
10
+ print(f" Installing {pkg}...")
11
+ subprocess.check_call([sys.executable, "-m", "pip", "install", pkg])
12
+
13
+ # NOW import normally
14
  import gradio as gr
15
  from llama_cpp import Llama
16
  from deep_translator import GoogleTranslator