Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 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;}
|