net2asif commited on
Commit
40b269a
·
verified ·
1 Parent(s): e5d7ca3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -9,8 +9,8 @@ Original file is located at
9
 
10
  # !pip install langchain openai qdrant-client gradio pandas tiktoken -U langchain-community
11
 
12
- from google.colab import userdata
13
- openai_api_key=userdata.get('openai_api_key')
14
 
15
  import gradio as gr
16
  import pandas as pd
@@ -21,10 +21,19 @@ from langchain.vectorstores import Qdrant
21
  from langchain.chains import VectorDBQA
22
  from langchain.llms import OpenAI
23
 
24
- qdrant_url=userdata.get('Qdrant')
25
- qdrant_api_key=userdata.get('qdrant_api_key')
26
- openai_api_key=userdata.get('openai_api_key')
27
- # groq_api_key=userdata.get('GROQ_API_KEY')
 
 
 
 
 
 
 
 
 
28
 
29
  #csv loader
30
  loader = CSVLoader(file_path='data.csv')
@@ -78,10 +87,10 @@ query="show me a best darmatology doctor in peshawar "
78
  docs=retriver.get_relevant_documents(query)
79
 
80
  #write a code for prety print
81
- for i in docs:
82
- print(i.page_content)
83
 
84
- docs[0].metadata.items()
85
 
86
  from langchain import PromptTemplate
87
 
 
9
 
10
  # !pip install langchain openai qdrant-client gradio pandas tiktoken -U langchain-community
11
 
12
+ # from google.colab import userdata
13
+ # openai_api_key=userdata.get('openai_api_key')
14
 
15
  import gradio as gr
16
  import pandas as pd
 
21
  from langchain.chains import VectorDBQA
22
  from langchain.llms import OpenAI
23
 
24
+ # qdrant_url=userdata.get('Qdrant')
25
+ # qdrant_api_key=userdata.get('qdrant_api_key')
26
+ # openai_api_key=userdata.get('openai_api_key')
27
+ # # groq_api_key=userdata.get('GROQ_API_KEY')
28
+
29
+ import os
30
+
31
+ openai_api_key = os.getenv('openai_api_key')
32
+ qdrant_url = os.getenv('QDRANT_URL')
33
+ qdrant_api_key = os.getenv('qdrant_api_key')
34
+
35
+ # Now you can use these keys in your application
36
+
37
 
38
  #csv loader
39
  loader = CSVLoader(file_path='data.csv')
 
87
  docs=retriver.get_relevant_documents(query)
88
 
89
  #write a code for prety print
90
+ # for i in docs:
91
+ # print(i.page_content)
92
 
93
+ # docs[0].metadata.items()
94
 
95
  from langchain import PromptTemplate
96