Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
-
os.environ['OPENAI_API_KEY'] =
|
| 3 |
import openai
|
| 4 |
import json
|
| 5 |
|
|
@@ -12,7 +12,7 @@ from langchain import OpenAI
|
|
| 12 |
# handling data on space
|
| 13 |
|
| 14 |
from huggingface_hub import HfFileSystem
|
| 15 |
-
fs = HfFileSystem(token=
|
| 16 |
|
| 17 |
text_list = fs.ls("datasets/GoChat/Gochat247_Data/Data", detail=False)
|
| 18 |
|
|
@@ -25,6 +25,7 @@ docs.append(doc)
|
|
| 25 |
|
| 26 |
|
| 27 |
# define LLM
|
|
|
|
| 28 |
llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="text-davinci-003"))
|
| 29 |
|
| 30 |
# define prompt helper
|
|
@@ -93,7 +94,7 @@ class Chatbot:
|
|
| 93 |
|
| 94 |
## Define Chat BOT Class to generate Response , handle chat history,
|
| 95 |
|
| 96 |
-
bot = Chatbot(
|
| 97 |
|
| 98 |
import gradio as gr
|
| 99 |
import time
|
|
@@ -121,4 +122,4 @@ with gr.Blocks() as demo:
|
|
| 121 |
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
| 124 |
-
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
os.environ['OPENAI_API_KEY'] = Open_AI_Key
|
| 3 |
import openai
|
| 4 |
import json
|
| 5 |
|
|
|
|
| 12 |
# handling data on space
|
| 13 |
|
| 14 |
from huggingface_hub import HfFileSystem
|
| 15 |
+
fs = HfFileSystem(token=HF_Key)
|
| 16 |
|
| 17 |
text_list = fs.ls("datasets/GoChat/Gochat247_Data/Data", detail=False)
|
| 18 |
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
# define LLM
|
| 28 |
+
|
| 29 |
llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="text-davinci-003"))
|
| 30 |
|
| 31 |
# define prompt helper
|
|
|
|
| 94 |
|
| 95 |
## Define Chat BOT Class to generate Response , handle chat history,
|
| 96 |
|
| 97 |
+
bot = Chatbot(Open_AI_Key, index=index)
|
| 98 |
|
| 99 |
import gradio as gr
|
| 100 |
import time
|
|
|
|
| 122 |
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
| 125 |
+
demo.launch(share=True)
|