HFswapnil commited on
Commit
9ef077e
·
verified ·
1 Parent(s): 02735b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -8,10 +8,6 @@ from fastapi.templating import Jinja2Templates
8
  from pydantic import BaseModel, Field
9
  from rag_util import Create_RAG_Prompt, ProcessDocuments
10
  import time
11
- import torch
12
-
13
-
14
- torch.set_num_threads(os.cpu_count())
15
 
16
 
17
  class DataModel(BaseModel):
@@ -49,7 +45,7 @@ async def generate(data: DataModel):
49
  # input_text = bleach.clean(data.data)
50
  history = chat_history[data.chatID] = [] if data.chatID not in chat_history else chat_history[data.chatID]
51
 
52
- llm_response = await generate_response(prompt=input_text, history=history)
53
 
54
  if data.chatID not in chat_history:
55
  chat_history[data.chatID] = []
@@ -62,7 +58,7 @@ async def generate(data: DataModel):
62
  # input_text = bleach.clean(data.data)
63
  prompt, context = Create_RAG_Prompt(input_text, chatID=data.chatID, history=chat_history[data.chatID] if chat_history[data.chatID] else [])
64
 
65
- llm_response = await generate_response(prompt=prompt, context=context)
66
 
67
  if data.chatID not in chat_history:
68
  chat_history[data.chatID] = []
 
8
  from pydantic import BaseModel, Field
9
  from rag_util import Create_RAG_Prompt, ProcessDocuments
10
  import time
 
 
 
 
11
 
12
 
13
  class DataModel(BaseModel):
 
45
  # input_text = bleach.clean(data.data)
46
  history = chat_history[data.chatID] = [] if data.chatID not in chat_history else chat_history[data.chatID]
47
 
48
+ llm_response = generate_response(prompt=input_text, history=history)
49
 
50
  if data.chatID not in chat_history:
51
  chat_history[data.chatID] = []
 
58
  # input_text = bleach.clean(data.data)
59
  prompt, context = Create_RAG_Prompt(input_text, chatID=data.chatID, history=chat_history[data.chatID] if chat_history[data.chatID] else [])
60
 
61
+ llm_response = generate_response(prompt=prompt, context=context)
62
 
63
  if data.chatID not in chat_history:
64
  chat_history[data.chatID] = []