dineshsawantdba commited on
Commit
c687e52
1 Parent(s): 534bcdb

uploaded app.py file

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_community.llms import OpenAI
2
+ #from langchain.llms import OpenAI
3
+ from langchain_community.chat_models import ChatOpenAI
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+ import streamlit as st
9
+ import os
10
+
11
+ #Function to load openai model and get response
12
+
13
+ def get_openai_response(question):
14
+ llm=OpenAI(model_name='gpt-3.5-turbo',temperature=0.5)
15
+ response=llm(question)
16
+ return response
17
+
18
+ # Inilize out streamlit app
19
+
20
+ st.set_page_config(page_title="Q&A Demo")
21
+ st.header("Langchain application")
22
+
23
+ input = st.text_input("Input: ",key="input")
24
+ response = get_openai_response(input)
25
+ submit=st.button("Ask the question")
26
+
27
+ ## If ask button is clicked
28
+
29
+ if submit:
30
+ st.subheader("The response is")
31
+ st.write(response)