update
Browse files
app.py
CHANGED
|
@@ -106,17 +106,27 @@ def whisper_stt(audio):
|
|
| 106 |
# LLM - Bloom Response
|
| 107 |
def lang_model_response(prompt, language):
|
| 108 |
print(f"Inside lang_model_response - Prompt is :{prompt}")
|
| 109 |
-
|
| 110 |
Answer: I am doing good, thanks.
|
| 111 |
Question: """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
if len(prompt) == 0:
|
| 113 |
prompt = """Question: Can you help me please?
|
| 114 |
Answer: Sure, I am here for you.
|
| 115 |
Question: """
|
| 116 |
|
| 117 |
if language == 'en':
|
| 118 |
-
prompt =
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
json_ = {"inputs": prompt,
|
| 122 |
"parameters":
|
|
@@ -139,7 +149,7 @@ def lang_model_response(prompt, language):
|
|
| 139 |
if language == 'en':
|
| 140 |
solution = output_tmp.split("Answer: ")[2].split("\n")[0]
|
| 141 |
else:
|
| 142 |
-
output_tmp.split(".")[1]
|
| 143 |
print(f"Final Bloom Response after splits is: {solution}")
|
| 144 |
return solution
|
| 145 |
|
|
|
|
| 106 |
# LLM - Bloom Response
|
| 107 |
def lang_model_response(prompt, language):
|
| 108 |
print(f"Inside lang_model_response - Prompt is :{prompt}")
|
| 109 |
+
p_en = """Question: How are you doing today?
|
| 110 |
Answer: I am doing good, thanks.
|
| 111 |
Question: """
|
| 112 |
+
p_es = """Pregunta: Cómo estás hoy?
|
| 113 |
+
Responder: Estoy bien, gracias.
|
| 114 |
+
Pregunta: """
|
| 115 |
+
p_fr = """Question: Comment vas-tu aujourd'hui?
|
| 116 |
+
Réponse: Je vais bien, merci.
|
| 117 |
+
Question: """
|
| 118 |
+
|
| 119 |
if len(prompt) == 0:
|
| 120 |
prompt = """Question: Can you help me please?
|
| 121 |
Answer: Sure, I am here for you.
|
| 122 |
Question: """
|
| 123 |
|
| 124 |
if language == 'en':
|
| 125 |
+
prompt = p_en + prompt + "\n" + "Answer: "
|
| 126 |
+
elif language == 'es':
|
| 127 |
+
prompt = p_es + prompt + "\n" + "Responder: "
|
| 128 |
+
elif language == 'fr':
|
| 129 |
+
prompt = p_fr + prompt + "\n" + "Réponse: "
|
| 130 |
|
| 131 |
json_ = {"inputs": prompt,
|
| 132 |
"parameters":
|
|
|
|
| 149 |
if language == 'en':
|
| 150 |
solution = output_tmp.split("Answer: ")[2].split("\n")[0]
|
| 151 |
else:
|
| 152 |
+
solution = output_tmp.split(".")[1]
|
| 153 |
print(f"Final Bloom Response after splits is: {solution}")
|
| 154 |
return solution
|
| 155 |
|