Rajagopal commited on
Commit
3d84967
·
1 Parent(s): 9f220ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -10,7 +10,8 @@ from PyPDF2 import PdfReader
10
  from langchain.document_loaders import TextLoader
11
  from langchain.indexes import VectorstoreIndexCreator
12
  from langchain.document_loaders import PyPDFLoader
13
-
 
14
 
15
 
16
  import os
@@ -19,15 +20,16 @@ import os
19
  os.environ["OPENAI_API_TYPE"] = "azure"
20
  os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview"
21
 
 
 
 
 
22
 
23
 
24
- llm = AzureChatOpenAI(
25
- deployment_name="esujnand", model_name="gpt-35-turbo"
26
- )
27
 
28
 
29
 
30
- st.title("Wipro CSRD AI 1")
31
 
32
  # description text
33
  st.write("Step 1: Summary of your selected section of CSRD... Sections in this are enviormental topic1, enviornamtal topic2 ")
@@ -100,20 +102,21 @@ if st.button("Ask Questions "):
100
  {concept}
101
  """
102
 
103
- prompt = PromptTemplate(
104
- input_variables=["concept"],
105
- template=template,
106
- )
107
-
108
-
109
- from langchain.chains import LLMChain
110
- chain = LLMChain(llm=llm, prompt=prompt)
 
111
 
112
  # Run the chain only specifying the input variable.
113
- st.write(chain.run(yourquestion))
114
 
115
 
116
- if st.button("Ask English "):
117
  template = """
118
  You are an expert on topics of Sustainability, Climate action and UN Sustainable Development Goals.
119
  Explain the concept of {concept} like i am a five
 
10
  from langchain.document_loaders import TextLoader
11
  from langchain.indexes import VectorstoreIndexCreator
12
  from langchain.document_loaders import PyPDFLoader
13
+ import os
14
+ import openai
15
 
16
 
17
  import os
 
20
  os.environ["OPENAI_API_TYPE"] = "azure"
21
  os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview"
22
 
23
+ openai.api_type = "azure"
24
+ openai.api_base = "https://embeddinguseopenai.openai.azure.com/"
25
+ openai.api_version = "2023-03-15-preview"
26
+ openai.api_key = os.environ["OPENAI_API_KEY"]
27
 
28
 
 
 
 
29
 
30
 
31
 
32
+ st.title("Wipro ")
33
 
34
  # description text
35
  st.write("Step 1: Summary of your selected section of CSRD... Sections in this are enviormental topic1, enviornamtal topic2 ")
 
102
  {concept}
103
  """
104
 
105
+ response = openai.ChatCompletion.create(
106
+ engine="gpt-35-turbo",
107
+ messages = [{"role":"system","content":"You are an AI assistant that helps people find information."},{"role":"user","content":"what is social indicicators"}],
108
+ temperature=0,
109
+ max_tokens=800,
110
+ top_p=1,
111
+ frequency_penalty=0,
112
+ presence_penalty=0,
113
+ stop=None)
114
 
115
  # Run the chain only specifying the input variable.
116
+ st.write(response)
117
 
118
 
119
+ if st.button("Ask trying here "):
120
  template = """
121
  You are an expert on topics of Sustainability, Climate action and UN Sustainable Development Goals.
122
  Explain the concept of {concept} like i am a five