Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,23 +74,24 @@ with gr.Blocks() as demo:
|
|
74 |
"hey there! its RecoNext, your favorite binge buddy! get started by telling me you age, preferred genre, and past tv shows or movies you have liked!"
|
75 |
)
|
76 |
return [("", greeting)], [{"role": "assistant", "content": greeting}]
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
74 |
"hey there! its RecoNext, your favorite binge buddy! get started by telling me you age, preferred genre, and past tv shows or movies you have liked!"
|
75 |
)
|
76 |
return [("", greeting)], [{"role": "assistant", "content": greeting}]
|
77 |
+
def respond(message, history):
|
78 |
+
best_next_watch = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
|
79 |
+
print(best_next_watch)
|
80 |
+
str_watch_chunks = "\n".join(best_next_watch)
|
81 |
+
messages = [
|
82 |
+
{"role":"system",
|
83 |
+
"content": "You are a gen-z helpful chatbot that helps teenagers find their next best watch, speak in gen-z terms and be natural. You should answer the users question based on " + str_watch_chunks + " ."
|
84 |
+
}
|
85 |
+
]
|
86 |
+
if history:
|
87 |
+
messages.extend(history)
|
88 |
+
messages.append(
|
89 |
+
{'role':'user',
|
90 |
+
'content':message}
|
91 |
+
)
|
92 |
+
response = client.chat_completion(
|
93 |
+
messages, max_tokens = 300, temperature=1.3, top_p=0.6
|
94 |
+
)
|
95 |
+
return response['choices'][0]['message']['content'].strip()
|
96 |
+
chatbot = gr.ChatInterface(respond, type="messages")
|
97 |
+
chatbot.launch()
|