Ahmed-14 commited on
Commit
393644d
1 Parent(s): f1830f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,8 +1,9 @@
1
 
2
  import os
3
- Open_AI_Key = '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'
4
- HF_Key = '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'
5
- os.environ['OPENAI_API_KEY'] = Open_AI_Key
 
6
  import openai
7
  import json
8
 
@@ -15,11 +16,12 @@ from langchain import OpenAI
15
  # handling data on space
16
 
17
  from huggingface_hub import HfFileSystem
18
- fs = HfFileSystem(token=HF_Key)
19
 
20
  text_list = fs.ls("datasets/GoChat/Gochat247_Data/Data", detail=False)
21
 
22
- data = fs.read_text(text_list[0])
 
23
 
24
  from llama_index import Document
25
  doc = Document(data)
@@ -49,7 +51,7 @@ class Chatbot:
49
 
50
  def __init__(self, index):
51
  self.index = index
52
- openai.api_key = Open_AI_Key
53
  self.chat_history = []
54
 
55
  QA_PROMPT_TMPL = (
 
1
 
2
  import os
3
+
4
+ openai_key= os.environ['OPENAI_API_KEY']
5
+ hf_key = os.environ['HF_KEY']
6
+
7
  import openai
8
  import json
9
 
 
16
  # handling data on space
17
 
18
  from huggingface_hub import HfFileSystem
19
+ fs = HfFileSystem(token=hf_key)
20
 
21
  text_list = fs.ls("datasets/GoChat/Gochat247_Data/Data", detail=False)
22
 
23
+ data = ''.join(fs.read_text(i) for i in text_list)
24
+
25
 
26
  from llama_index import Document
27
  doc = Document(data)
 
51
 
52
  def __init__(self, index):
53
  self.index = index
54
+ openai.api_key = openai_key
55
  self.chat_history = []
56
 
57
  QA_PROMPT_TMPL = (