NAB1108 commited on
Commit
8d87d13
·
1 Parent(s): 0196549

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -98,20 +98,16 @@ def infer(question):
98
  prompt_text = question
99
  if prompt_text:
100
  query1 = query1 + "\nUser: " + prompt_text + "\nBot: "
101
- if limit <= 5:
102
- result = chain(query1)
103
- query1 = query1 + result['answer']
104
- query1 = openai.ChatCompletion.create(
105
- model="gpt-3.5-turbo",
106
- messages=[
107
- {"role": "system", "content": "You are provided with chat history and latset conversation between user and bot. Summarise the history and latest conversationin minimum most tokens possible. Do not include greetings in the summary like hi, hello, etc."},
108
- {"role": "user", "content": query1},
109
- ]
110
- ) ["choices"][0]["message"]["content"].replace("'", "")
111
- limit += 1
112
- return result['answer']
113
- else:
114
- return "Usage Limit reached :("
115
 
116
  css="""
117
  #col-container { margin-left: auto; margin-right: auto;}
 
98
  prompt_text = question
99
  if prompt_text:
100
  query1 = query1 + "\nUser: " + prompt_text + "\nBot: "
101
+ result = chain(query1)
102
+ query1 = query1 + result['answer']
103
+ query1 = openai.ChatCompletion.create(
104
+ model="gpt-3.5-turbo",
105
+ messages=[
106
+ {"role": "system", "content": "You are provided with chat history and latset conversation between user and bot. Summarise the history and latest conversationin minimum most tokens possible. Do not include greetings in the summary like hi, hello, etc."},
107
+ {"role": "user", "content": query1},
108
+ ]
109
+ ) ["choices"][0]["message"]["content"].replace("'", "")
110
+ return result['answer']
 
 
 
 
111
 
112
  css="""
113
  #col-container { margin-left: auto; margin-right: auto;}