Commit
·
1b46e40
1
Parent(s):
2f984d9
Update app.py
Browse files
app.py
CHANGED
@@ -37,35 +37,36 @@ import os
|
|
37 |
|
38 |
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base.en")
|
39 |
|
40 |
-
def predict():
|
41 |
|
42 |
customer_service_prompt = """
|
43 |
Create an email response based on the content of incoming emails. Your response should be tailored to the nature of the inquiry:
|
44 |
-
|
45 |
If the email mentions 'customer support,' reply with a message indicating that their request has been forwarded, and your team will respond within 48 hours. Include the support email address for further communication.
|
46 |
-
|
47 |
If the email indicates the customer is looking for new products, provide a response that shares a list of available products and directs them to your website for more information.
|
48 |
-
|
49 |
For payment-related inquiries, respond by informing the customer that your finance team will review their request and get back to them within the next 48 hours. Include the finance team's email address for any additional communication.
|
50 |
-
|
51 |
Ensure that the responses are clear, polite, and informative. Use appropriate language and tone for each scenario."
|
52 |
User's Query: {user_query}
|
53 |
Mail reply:
|
54 |
"""
|
|
|
|
|
|
|
55 |
|
56 |
prompt = PromptTemplate(
|
57 |
input_variables=["user_query"],
|
58 |
-
template=
|
59 |
|
60 |
inputs = {"input": ""}
|
61 |
|
62 |
chatgpt_llm = ChatOpenAI(model_name='gpt-3.5-turbo-16k', temperature=0,
|
63 |
-
openai_api_key=
|
64 |
-
|
65 |
-
|
66 |
chatgpt_chain = LLMChain(
|
67 |
llm=chatgpt_llm,
|
68 |
prompt=prompt)
|
|
|
|
|
|
|
|
|
69 |
|
70 |
|
71 |
def transcribe(audio):
|
@@ -88,4 +89,4 @@ demo = gr.Interface(
|
|
88 |
|
89 |
|
90 |
|
91 |
-
demo.launch()
|
|
|
37 |
|
38 |
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base.en")
|
39 |
|
40 |
+
def predict(user_input):
|
41 |
|
42 |
customer_service_prompt = """
|
43 |
Create an email response based on the content of incoming emails. Your response should be tailored to the nature of the inquiry:
|
|
|
44 |
If the email mentions 'customer support,' reply with a message indicating that their request has been forwarded, and your team will respond within 48 hours. Include the support email address for further communication.
|
|
|
45 |
If the email indicates the customer is looking for new products, provide a response that shares a list of available products and directs them to your website for more information.
|
|
|
46 |
For payment-related inquiries, respond by informing the customer that your finance team will review their request and get back to them within the next 48 hours. Include the finance team's email address for any additional communication.
|
|
|
47 |
Ensure that the responses are clear, polite, and informative. Use appropriate language and tone for each scenario."
|
48 |
User's Query: {user_query}
|
49 |
Mail reply:
|
50 |
"""
|
51 |
+
|
52 |
+
template = customer_service_prompt.format(user_query=user_input)
|
53 |
+
|
54 |
|
55 |
prompt = PromptTemplate(
|
56 |
input_variables=["user_query"],
|
57 |
+
template=template)
|
58 |
|
59 |
inputs = {"input": ""}
|
60 |
|
61 |
chatgpt_llm = ChatOpenAI(model_name='gpt-3.5-turbo-16k', temperature=0,
|
62 |
+
openai_api_key='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')
|
|
|
|
|
63 |
chatgpt_chain = LLMChain(
|
64 |
llm=chatgpt_llm,
|
65 |
prompt=prompt)
|
66 |
+
|
67 |
+
response = chatgpt_chain.run(inputs)
|
68 |
+
|
69 |
+
return response
|
70 |
|
71 |
|
72 |
def transcribe(audio):
|
|
|
89 |
|
90 |
|
91 |
|
92 |
+
demo.launch()
|