PlasmarineXD commited on
Commit
b7b9b8e
·
1 Parent(s): 95ab416

Add installation script to app.py and change install_dependencies

Browse files
Files changed (2) hide show
  1. app.py +5 -4
  2. install_dependencies.sh +3 -0
app.py CHANGED
@@ -1,16 +1,17 @@
1
- import os
2
  import subprocess
 
3
 
4
- # Install dependencies if not present
5
  def install(package):
6
  subprocess.check_call([os.sys.executable, "-m", "pip", "install", package])
7
 
 
8
  install("torch")
 
9
  install("streamlit")
10
  install("transformers")
11
- install("flash-attn")
12
 
13
- # Your existing imports and code
14
  import streamlit as st
15
  from transformers import AutoModel, AutoTokenizer
16
 
 
 
1
  import subprocess
2
+ import os
3
 
4
+ # Function to install packages
5
  def install(package):
6
  subprocess.check_call([os.sys.executable, "-m", "pip", "install", package])
7
 
8
+ # Install necessary packages
9
  install("torch")
10
+ install("flash-attn")
11
  install("streamlit")
12
  install("transformers")
 
13
 
14
+ # Import installed packages
15
  import streamlit as st
16
  from transformers import AutoModel, AutoTokenizer
17
 
install_dependencies.sh CHANGED
@@ -1,5 +1,8 @@
1
  #!/bin/bash
2
 
 
 
 
3
  # Install torch first
4
  pip install torch
5
 
 
1
  #!/bin/bash
2
 
3
+ # Ensure pip is up to date
4
+ pip install --upgrade pip
5
+
6
  # Install torch first
7
  pip install torch
8