Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ def transcribe(audio):
|
|
14 |
def sentiment(text):
|
15 |
response = openai.Completion.create(
|
16 |
model="text-davinci-003",
|
17 |
-
prompt=f"calssify the text into below sentiment category\n\ntext : {text}\"\n\n['
|
18 |
temperature=1,
|
19 |
max_tokens=256,
|
20 |
top_p=1,
|
@@ -32,7 +32,7 @@ def chatbot(input):
|
|
32 |
if input:
|
33 |
input = transcribe(input)
|
34 |
messages.append({"role": "user", "content": input})
|
35 |
-
if sentiment(input) == '
|
36 |
reply = "Sorry for any inconvinience. We are tranfering your call."
|
37 |
else:
|
38 |
chat = openai.ChatCompletion.create(
|
@@ -58,8 +58,8 @@ outputs = gr.outputs.Textbox(label="Reply")
|
|
58 |
gr.Interface(fn= chatbot,
|
59 |
inputs= inputs,
|
60 |
outputs= outputs,
|
61 |
-
title="chatbot",
|
62 |
-
description="
|
63 |
theme="compact").launch()
|
64 |
|
65 |
|
|
|
14 |
def sentiment(text):
|
15 |
response = openai.Completion.create(
|
16 |
model="text-davinci-003",
|
17 |
+
prompt=f"calssify the text into below sentiment category\n\ntext : {text}\"\n\n['positive','negative','neutral']\n",
|
18 |
temperature=1,
|
19 |
max_tokens=256,
|
20 |
top_p=1,
|
|
|
32 |
if input:
|
33 |
input = transcribe(input)
|
34 |
messages.append({"role": "user", "content": input})
|
35 |
+
if sentiment(input) == 'negative':
|
36 |
reply = "Sorry for any inconvinience. We are tranfering your call."
|
37 |
else:
|
38 |
chat = openai.ChatCompletion.create(
|
|
|
58 |
gr.Interface(fn= chatbot,
|
59 |
inputs= inputs,
|
60 |
outputs= outputs,
|
61 |
+
title="PepsiCo-chatbot",
|
62 |
+
description="Give your order",
|
63 |
theme="compact").launch()
|
64 |
|
65 |
|