File size: 1,751 Bytes
c2c192a
 
 
 
 
 
 
 
 
 
 
 
3d84967
 
314c283
c2c192a
 
 
 
 
 
 
 
3d84967
 
 
 
c2c192a
 
 
a451d2e
 
c2c192a
a451d2e
c2c192a
a451d2e
c2c192a
 
 
a451d2e
c2c192a
 
9f220ea
 
 
c2c192a
9f220ea
 
c2c192a
 
3d84967
 
6021af7
3d84967
 
 
 
 
 
c2c192a
 
3d84967
c2c192a
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import streamlit as st
from langchain import OpenAI, PromptTemplate, LLMChain
from langchain.text_splitter import CharacterTextSplitter
from langchain.chains.mapreduce import MapReduceChain
from langchain.prompts import PromptTemplate
from langchain.chat_models import AzureChatOpenAI
from langchain.chains.summarize import load_summarize_chain
from langchain.chains import AnalyzeDocumentChain
from PyPDF2 import PdfReader
from langchain.document_loaders import TextLoader
from langchain.indexes import VectorstoreIndexCreator
from langchain.document_loaders import PyPDFLoader
import os
import openai
from PIL import Image


import os


os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview"

openai.api_type = "azure"
openai.api_base = "https://embeddinguseopenai.openai.azure.com/"
openai.api_version = "2023-03-15-preview"
openai.api_key = os.environ["OPENAI_API_KEY"]
 


image = Image.open('Wipro logo.png')
st.image(image)

st.title("Ask anything on CSRD or Wipro sustainability report")

st.subheader("Type your question here ")



yourquestion = st.text_input('Your topic', 'What is Wipro doing on biodiversity?')
st.write('Your input is ', yourquestion)



if st.button("Ask Questions "):
    template = """
    You are an AI assistant. 
    {concept}
    """

    response = openai.ChatCompletion.create(
      engine="gpt-35-turbo",
      messages = [{"role":"system","content":"You are an AI assistant that helps people find information."},{"role":"user","content":yourquestion}],
      temperature=0,
      max_tokens=800,
      top_p=1,
      frequency_penalty=0,
      presence_penalty=0,
      stop=None)

    # Run the chain only specifying the input variable.
    st.write(response)