Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import streamlit as st
|
|
3 |
import os
|
4 |
import pkg_resources
|
5 |
|
|
|
6 |
def is_installed(package_name, version):
|
7 |
try:
|
8 |
pkg = pkg_resources.get_distribution(package_name)
|
@@ -23,16 +24,9 @@ def install_packages():
|
|
23 |
if install_commands:
|
24 |
os.system(" && ".join(install_commands))
|
25 |
|
26 |
-
#
|
27 |
install_packages()
|
28 |
|
29 |
-
# os.system("pip uninstall -y spaces")
|
30 |
-
# os.system('pip install spaces==0.12.0')
|
31 |
-
# os.system("pip uninstall -y gradio")
|
32 |
-
# os.system("pip uninstall -y inflect")
|
33 |
-
# os.system("pip uninstall -y pydantic")
|
34 |
-
# os.system('pip install pydantic==1.8.2')
|
35 |
-
|
36 |
|
37 |
import re
|
38 |
import json
|
@@ -42,18 +36,10 @@ import pandas as pd
|
|
42 |
from haystack.schema import Document
|
43 |
from haystack.document_stores import PineconeDocumentStore
|
44 |
from haystack.nodes import EmbeddingRetriever
|
45 |
-
# from huggingface_hub import login, HfApi, hf_hub_download, InferenceClient
|
46 |
import openai
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
# for local st testing, may need to run source ~/.zshrc to point to env vars
|
52 |
|
53 |
-
# Get HF token (used for llama2)
|
54 |
-
# hf_token = os.environ["HF_TOKEN"]
|
55 |
-
# login(token=hf_token, add_to_git_credential=True)
|
56 |
-
|
57 |
# Get openai API key
|
58 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
59 |
|
|
|
3 |
import os
|
4 |
import pkg_resources
|
5 |
|
6 |
+
# Using this wacky hack to get around the massively ridicolous managed env loading order
|
7 |
def is_installed(package_name, version):
|
8 |
try:
|
9 |
pkg = pkg_resources.get_distribution(package_name)
|
|
|
24 |
if install_commands:
|
25 |
os.system(" && ".join(install_commands))
|
26 |
|
27 |
+
# install packages if necessary
|
28 |
install_packages()
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
import re
|
32 |
import json
|
|
|
36 |
from haystack.schema import Document
|
37 |
from haystack.document_stores import PineconeDocumentStore
|
38 |
from haystack.nodes import EmbeddingRetriever
|
|
|
39 |
import openai
|
40 |
|
|
|
|
|
|
|
41 |
# for local st testing, may need to run source ~/.zshrc to point to env vars
|
42 |
|
|
|
|
|
|
|
|
|
43 |
# Get openai API key
|
44 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
45 |
|