VinayakMane47 commited on
Commit
5e7cfc6
1 Parent(s): ba50b2d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+ from dotenv import load_dotenv
3
+ import streamlit as st
4
+ import os
5
+
6
+ load_dotenv()
7
+
8
+
9
+ def get_openai_response(question):
10
+ llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY") ,temperature=0.6)
11
+ response = llm(question)
12
+ return response
13
+
14
+ print(get_openai_response("who is MS dhoni"))
15
+
16
+ ## initiliaze streamlit app
17
+
18
+ st.set_page_config(page_title="Q&A demo app")
19
+ st.header("Langchain Application")
20
+ input = st.text_input("Input:",key="input")
21
+ response = get_openai_response(question=input)
22
+ submit = st.button("Ask question")
23
+
24
+ if submit:
25
+ st.subheader("The response is ")
26
+ st.write(response)