Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,52 +17,50 @@ import time
|
|
17 |
image = Image.open('Wipro logo.png')
|
18 |
st.image(image)
|
19 |
|
20 |
-
st.title("Wipro
|
21 |
|
22 |
-
st.header("Enable clients to prepare for CSRD.. ")
|
23 |
|
|
|
24 |
|
25 |
-
genre = st.radio(
|
26 |
-
"Choose a CSRD focus area for AI question answering",
|
27 |
-
('E1-Climate Change', 'E4-Biodiversity and ecosystem', 'S1-Own Workforce'), index=0)
|
28 |
|
29 |
-
|
30 |
|
31 |
-
if
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
if genre == 'E4-Biodiversity and ecosystem':
|
42 |
-
url = "https://www.efrag.org/Assets/Download?assetUrl=%2Fsites%2Fwebpublishing%2FSiteAssets%2F11%2520Draft%2520ESRS%2520E4%2520Biodiversity%2520and%2520ecosystems%2520November%25202022.pdf"
|
43 |
-
samplequestions = ["What are the Biodiversity related indicators?", "List all the disclosure requirments listed in page 3?"]
|
44 |
-
if genre == 'S1-Own Workforce':
|
45 |
-
url = "https://www.efrag.org/Assets/Download?assetUrl=%2Fsites%2Fwebpublishing%2FSiteAssets%2F13%2520Draft%2520ESRS%2520S1%2520Own%2520workforce%2520November%25202022.pdf"
|
46 |
-
samplequestions = ["What are the social related indicators?", "List all the disclosure requirments listed in page 3?"]
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
st.write(" :green[ Ask any thing on your mind...just type your question here...]")
|
55 |
-
yourquestion = st.text_input('Your question', sampleselectedquestion)
|
56 |
-
st.write('Your typed .. ', yourquestion)
|
57 |
-
|
58 |
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
os.environ['OPENAI_API_TYPE'] = 'azure'
|
62 |
os.environ['OPENAI_API_VERSION'] = '2023-03-15-preview'
|
63 |
|
64 |
-
llmgpt3 = AzureOpenAI( deployment_name="testdavanci", model_name="text-davinci-003" )
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
aimethod = st.radio(
|
68 |
"Choose a AI brain or document comprehension method",
|
@@ -74,7 +72,7 @@ if aimethod == '2 minutes AI method map_reduce':
|
|
74 |
if aimethod == '4 minutes AI method refine':
|
75 |
mychain_type = "refine"
|
76 |
|
77 |
-
|
78 |
|
79 |
|
80 |
loader1 = PyPDFLoader(url)
|
|
|
17 |
image = Image.open('Wipro logo.png')
|
18 |
st.image(image)
|
19 |
|
20 |
+
st.title("Wipro impact | The inquisitive sustainability leader: Learn some of the best practices in sustainability from success stories of leading companies.. ")
|
21 |
|
|
|
22 |
|
23 |
+
st.header("Welcome!. Today, What company's sustainability story is inspiring you ?.. ")
|
24 |
|
|
|
|
|
|
|
25 |
|
26 |
+
myurl = st.text_input("Give the URL to find a sustainability or annual report", "Type URL of any company PDF document here")
|
27 |
|
28 |
+
if st.button("Load this report "):
|
29 |
+
loader1 = PyPDFLoader(myurl)
|
30 |
+
|
31 |
+
index = VectorstoreIndexCreator(
|
32 |
+
# split the documents into chunks
|
33 |
+
text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0),
|
34 |
+
# select which embeddings we want to use
|
35 |
+
embedding=langchainembeddings,
|
36 |
+
# use Chroma as the vectorestore to index and search embeddings
|
37 |
+
vectorstore_cls=Chroma
|
38 |
+
).from_loaders([loader1])
|
39 |
+
|
40 |
+
st.write("loaded")
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
+
yourquestion = st.text_input('Ask your question on best practices', 'What is Wipro plans for Biodiversity in 2024?')
|
47 |
+
st.write('Your input is ', yourquestion)
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
aimethod = st.radio(
|
50 |
+
"Choose a AI brain",
|
51 |
+
('GPT3', 'GPT3.5' ), index=1)
|
52 |
|
53 |
|
54 |
os.environ['OPENAI_API_TYPE'] = 'azure'
|
55 |
os.environ['OPENAI_API_VERSION'] = '2023-03-15-preview'
|
56 |
|
57 |
+
#llmgpt3 = AzureOpenAI( deployment_name="testdavanci", model_name="text-davinci-003" )
|
58 |
+
llmchatgpt = AzureOpenAI( deployment_name="esujnand", model_name="gpt-35-turbo" )
|
59 |
+
|
60 |
+
if st.button("Ask Best practices "):
|
61 |
+
answer = index.query(llm=llmchatgpt, question=query, chain_type="map_reduce")
|
62 |
+
st.write(answer)
|
63 |
+
|
64 |
|
65 |
aimethod = st.radio(
|
66 |
"Choose a AI brain or document comprehension method",
|
|
|
72 |
if aimethod == '4 minutes AI method refine':
|
73 |
mychain_type = "refine"
|
74 |
|
75 |
+
|
76 |
|
77 |
|
78 |
loader1 = PyPDFLoader(url)
|