4darsh-Dev commited on
Commit
676c678
·
verified ·
1 Parent(s): 864e44a

fix enable_queue depreceated error

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -9,7 +9,6 @@ import os
9
 
10
  # Load environment variables
11
  load_dotenv()
12
-
13
  PINECONE_API_KEY = os.getenv('PINECONE_API_KEY')
14
  index_name = "apple-chatbot"
15
 
@@ -27,7 +26,6 @@ class AppleChatbot:
27
  def initialize_chatbot(self):
28
  embeddings = self.download_hf_embeddings()
29
  model_path = "TheBloke/Llama-2-7B-Chat-GGML"
30
-
31
  llm = CTransformers(
32
  model=model_path,
33
  model_type="llama",
@@ -43,14 +41,11 @@ class AppleChatbot:
43
 
44
  # Use the same prompt template from your original application
45
  prompt_template = """
46
- You are an expert in apple cultivation and orchard management. Use the following pieces of context to answer the question at the end.
47
  If you don't know the answer, just say that you don't know, don't try to make up an answer.
48
-
49
  {context}
50
-
51
  Question: {question}
52
  Answer:"""
53
-
54
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
55
  chain_type_kwargs = {"prompt": PROMPT}
56
 
@@ -97,9 +92,9 @@ demo = gr.ChatInterface(
97
 
98
  # Launch the interface
99
  if __name__ == "__main__":
 
100
  demo.launch(
101
  server_name="0.0.0.0",
102
  server_port=7860,
103
- share=True,
104
- enable_queue=True
105
  )
 
9
 
10
  # Load environment variables
11
  load_dotenv()
 
12
  PINECONE_API_KEY = os.getenv('PINECONE_API_KEY')
13
  index_name = "apple-chatbot"
14
 
 
26
  def initialize_chatbot(self):
27
  embeddings = self.download_hf_embeddings()
28
  model_path = "TheBloke/Llama-2-7B-Chat-GGML"
 
29
  llm = CTransformers(
30
  model=model_path,
31
  model_type="llama",
 
41
 
42
  # Use the same prompt template from your original application
43
  prompt_template = """
44
+ You are an expert in apple cultivation and orchard management. Use the following pieces of context to answer the question at the end.
45
  If you don't know the answer, just say that you don't know, don't try to make up an answer.
 
46
  {context}
 
47
  Question: {question}
48
  Answer:"""
 
49
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
50
  chain_type_kwargs = {"prompt": PROMPT}
51
 
 
92
 
93
  # Launch the interface
94
  if __name__ == "__main__":
95
+ demo.queue() # Enable queuing
96
  demo.launch(
97
  server_name="0.0.0.0",
98
  server_port=7860,
99
+ share=True
 
100
  )