avinashp1 commited on
Commit
fec8f6c
·
1 Parent(s): 2f7d929

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+ import streamlit as st
3
+ import os
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+ def get_openai_response(question):
9
+ llm=OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"),model_name="text-davinci-003",temperature=0.5)
10
+ response=llm(question)
11
+ return response
12
+
13
+
14
+ st.set_page_config("ChatBot")
15
+
16
+ st.header("Langchain App")
17
+
18
+ input=st.text_input("Input:",key="input")
19
+ response=get_openai_response(input)
20
+
21
+ submit=st.button('Answer')
22
+ if submit:
23
+ st.subheader("The Response is")
24
+ st.write(response)