adinarayana commited on
Commit
da76e2e
·
verified ·
1 Parent(s): 2f683d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -11
app.py CHANGED
@@ -1,5 +1,4 @@
1
- pip install langchain
2
-
3
  from langchain.llms import OpenAI
4
 
5
  # from dotenv import load_dotenv
@@ -26,19 +25,61 @@ def get_openai_response(question):
26
 
27
  ## streamlit app
28
 
29
- st.set_page_config(page_title="Trail Demo")
30
- st.header("Sample")
31
- st.write("UPDATE: This app uses the 'gpt-3.5-turbo-instruct' model through Langchain")
32
 
33
 
34
- # input = st.text_input("Enter your query: ", key=input)
35
- uploaded_file = st.file_uploader('Choose your .pdf file', type="pdf")
36
- if uploaded_file is not None:
37
- df = extract_data(uploaded_file)
38
- response = get_openai_response(df)
39
 
40
 
41
  submit = st.button("Generate")
42
  if submit:
43
  st.subheader("The response is")
44
- st.write(response)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # QandA Chatbot - attempt 1
 
2
  from langchain.llms import OpenAI
3
 
4
  # from dotenv import load_dotenv
 
25
 
26
  ## streamlit app
27
 
28
+ st.set_page_config(page_title="QandA Demo")
29
+ st.header("QandA - Langchain Application")
30
+ st.write("UPDATE: This app uses the 'gpt-3.5-turbo-instruct' model through Langchain to answer queries")
31
 
32
 
33
+ input = st.text_input("Enter your query: ", key=input)
34
+ response = get_openai_response(input)
 
 
 
35
 
36
 
37
  submit = st.button("Generate")
38
  if submit:
39
  st.subheader("The response is")
40
+ st.write(response)
41
+
42
+ # pip install langchain
43
+
44
+ # from langchain.llms import OpenAI
45
+
46
+ # # from dotenv import load_dotenv
47
+ # import os
48
+
49
+ # # take environment variables from .env
50
+ # # load_dotenv()
51
+
52
+ # import streamlit as st
53
+
54
+ # # load OpenAI model and get a response
55
+
56
+
57
+ # def get_openai_response(question):
58
+ # llm = OpenAI(
59
+ # openai_api_key=os.getenv("OPEN_API_KEY"),
60
+ # model_name="gpt-3.5-turbo-instruct",
61
+ # temperature=0.6,
62
+ # )
63
+ # response = llm(question)
64
+ # return response
65
+ # # modify with chain and other stuff
66
+
67
+
68
+ # ## streamlit app
69
+
70
+ # st.set_page_config(page_title="Trail Demo")
71
+ # st.header("Sample")
72
+ # st.write("UPDATE: This app uses the 'gpt-3.5-turbo-instruct' model through Langchain")
73
+
74
+
75
+ # # input = st.text_input("Enter your query: ", key=input)
76
+ # uploaded_file = st.file_uploader('Choose your .pdf file', type="pdf")
77
+ # if uploaded_file is not None:
78
+ # df = extract_data(uploaded_file)
79
+ # response = get_openai_response(df)
80
+
81
+
82
+ # submit = st.button("Generate")
83
+ # if submit:
84
+ # st.subheader("The response is")
85
+ # st.write(response)