Update app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,16 @@ openai.api_key = os.environ["OPENAI_API_KEY"]
|
|
27 |
|
28 |
|
29 |
|
|
|
|
|
30 |
|
|
|
31 |
|
32 |
-
st.
|
33 |
|
34 |
|
35 |
|
36 |
-
|
37 |
-
yourquestion = st.text_input('Your topic', 'netzero')
|
38 |
st.write('Your input is ', yourquestion)
|
39 |
|
40 |
|
@@ -59,59 +61,8 @@ if st.button("Ask Questions "):
|
|
59 |
st.write(response)
|
60 |
|
61 |
|
62 |
-
if st.button("Ask Questions Simplify "):
|
63 |
-
template = """
|
64 |
-
You are an AI assistant.
|
65 |
-
{concept}
|
66 |
-
"""
|
67 |
-
|
68 |
-
response = openai.ChatCompletion.create(
|
69 |
-
engine="gpt-35-turbo",
|
70 |
-
messages = [{"role":"system","content":"You are an AI assistant that helps people find information. Please explain the information like i am a five."},{"role":"user","content":yourquestion}],
|
71 |
-
temperature=0,
|
72 |
-
max_tokens=800,
|
73 |
-
top_p=1,
|
74 |
-
frequency_penalty=0,
|
75 |
-
presence_penalty=0,
|
76 |
-
stop=None)
|
77 |
-
|
78 |
-
# Run the chain only specifying the input variable.
|
79 |
-
st.write(response)
|
80 |
-
|
81 |
-
if st.button("Ask trying here "):
|
82 |
-
template = """
|
83 |
-
You are an expert on topics of Sustainability, Climate action and UN Sustainable Development Goals.
|
84 |
-
Explain the concept of {concept} like i am a five
|
85 |
-
"""
|
86 |
-
|
87 |
-
prompt = PromptTemplate(
|
88 |
-
input_variables=["concept"],
|
89 |
-
template=template,
|
90 |
-
)
|
91 |
|
92 |
|
93 |
-
from langchain.chains import LLMChain
|
94 |
-
chain = LLMChain(llm=llm, prompt=prompt)
|
95 |
-
|
96 |
-
# Run the chain only specifying the input variable.
|
97 |
-
st.write(chain.run(yourquestion))
|
98 |
|
99 |
|
100 |
|
101 |
-
if st.button("Ask Hindi "):
|
102 |
-
template = """
|
103 |
-
You are an expert on topics of Sustainability, Climate action and UN Sustainable Development Goals.
|
104 |
-
Explain the concept of {concept} in Hindi
|
105 |
-
"""
|
106 |
-
|
107 |
-
prompt = PromptTemplate(
|
108 |
-
input_variables=["concept"],
|
109 |
-
template=template,
|
110 |
-
)
|
111 |
-
|
112 |
-
|
113 |
-
from langchain.chains import LLMChain
|
114 |
-
chain = LLMChain(llm=llm, prompt=prompt)
|
115 |
-
|
116 |
-
# Run the chain only specifying the input variable.
|
117 |
-
st.write(chain.run(yourquestion))
|
|
|
27 |
|
28 |
|
29 |
|
30 |
+
image = Image.open('Wipro logo.png')
|
31 |
+
st.image(image)
|
32 |
|
33 |
+
st.title("Ask anything on CSRD or Wipro sustainability report")
|
34 |
|
35 |
+
st.subheader("Type your question here ")
|
36 |
|
37 |
|
38 |
|
39 |
+
yourquestion = st.text_input('Your topic', 'What is Wipro doing on biodiversity?')
|
|
|
40 |
st.write('Your input is ', yourquestion)
|
41 |
|
42 |
|
|
|
61 |
st.write(response)
|
62 |
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|