sofiia19 commited on
Commit
4c1d173
1 Parent(s): c4c5c2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -1,5 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
- !pip install litellm gradio datasets rank_bm25
3
  from litellm import completion
4
  import os
5
 
 
1
+ import subprocess
2
+ import sys
3
+
4
+ def install(package):
5
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
6
+
7
+ # Install required libraries
8
+ for package in ["litellm", "gradio", "datasets", "rank_bm25", "sentence-transformers"]:
9
+ try:
10
+ __import__(package)
11
+ except ImportError:
12
+ install(package)
13
 
 
14
  from litellm import completion
15
  import os
16