Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,30 @@
|
|
1 |
-
import streamlit as st
|
2 |
from transformers import AutoModel, AutoTokenizer
|
3 |
import torch
|
4 |
-
import sys
|
5 |
-
import subprocess
|
6 |
import streamlit as st
|
|
|
|
|
|
|
|
|
7 |
|
|
|
8 |
st.write(f"Python version: {sys.version}")
|
9 |
-
st.write(f"Pip version: {subprocess.check_output(['pip', '--version']).decode()}")
|
10 |
|
|
|
11 |
try:
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
st.
|
17 |
-
st.code(subprocess.check_output(['pip', 'list']).decode())
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Page config
|
21 |
st.set_page_config(
|
|
|
1 |
+
# import streamlit as st
|
2 |
from transformers import AutoModel, AutoTokenizer
|
3 |
import torch
|
|
|
|
|
4 |
import streamlit as st
|
5 |
+
import subprocess
|
6 |
+
import sys
|
7 |
+
|
8 |
+
st.title("Package Installation Test")
|
9 |
|
10 |
+
# Display Python version
|
11 |
st.write(f"Python version: {sys.version}")
|
|
|
12 |
|
13 |
+
# Try to install transformers
|
14 |
try:
|
15 |
+
st.write("Attempting to install transformers...")
|
16 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "transformers"])
|
17 |
+
st.success("Transformers package installed successfully!")
|
18 |
+
except Exception as e:
|
19 |
+
st.error(f"Error installing transformers: {str(e)}")
|
|
|
20 |
|
21 |
+
# List installed packages
|
22 |
+
st.write("Installed packages:")
|
23 |
+
try:
|
24 |
+
installed_packages = subprocess.check_output([sys.executable, "-m", "pip", "list"]).decode()
|
25 |
+
st.code(installed_packages)
|
26 |
+
except Exception as e:
|
27 |
+
st.error(f"Error listing packages: {str(e)}")
|
28 |
|
29 |
# Page config
|
30 |
st.set_page_config(
|