Spaces:
Sleeping
Sleeping
Update app.py
Browse filesconnected to sing module
app.py
CHANGED
@@ -98,7 +98,7 @@ def respond(
|
|
98 |
global responded_answer
|
99 |
# Main Decision Module
|
100 |
decision_response = ""
|
101 |
-
judge_main_message = f"Here is a query: '{message}', Determine if this query is asking about one of the topics included in the list below. If it is, please directly provide only one name of the topic;
|
102 |
m_message = [{"role": "user", "content": judge_main_message}]
|
103 |
for m in client.chat_completion(
|
104 |
m_message,
|
@@ -123,8 +123,11 @@ def respond(
|
|
123 |
responded_answer = result
|
124 |
return result
|
125 |
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
128 |
else:
|
129 |
#others
|
130 |
system_message = "You are a helpful chatbot that answers questions. Give any answer within 50 words."
|
@@ -161,7 +164,16 @@ def tts_part():
|
|
161 |
global llama_responded
|
162 |
global responded_answer
|
163 |
result = ""
|
164 |
-
if responded_answer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
text = responded_answer
|
166 |
|
167 |
client = Client("tonyassi/voice-clone")
|
@@ -173,7 +185,7 @@ def tts_part():
|
|
173 |
llama_responded = 0
|
174 |
responded_answer = ""
|
175 |
return result
|
176 |
-
|
177 |
def create_interface():
|
178 |
with gr.Blocks() as demo:
|
179 |
|
|
|
98 |
global responded_answer
|
99 |
# Main Decision Module
|
100 |
decision_response = ""
|
101 |
+
judge_main_message = f"Here is a query: '{message}', Determine if this query is asking about one of the topics included in the list below. If it is, please directly provide only one name of the topic; If the query is about singing a song, you just reply 'sing'; Otherwise for any other queries, you just reply 'no'. The list of topics is: [movie, music]"
|
102 |
m_message = [{"role": "user", "content": judge_main_message}]
|
103 |
for m in client.chat_completion(
|
104 |
m_message,
|
|
|
123 |
responded_answer = result
|
124 |
return result
|
125 |
|
126 |
+
elif "sing" in decision_response:
|
127 |
+
llama_responded = 1
|
128 |
+
responded_answer = "SING"
|
129 |
+
return "SING"
|
130 |
+
|
131 |
else:
|
132 |
#others
|
133 |
system_message = "You are a helpful chatbot that answers questions. Give any answer within 50 words."
|
|
|
164 |
global llama_responded
|
165 |
global responded_answer
|
166 |
result = ""
|
167 |
+
if responded_answer == "SING":
|
168 |
+
client = Client("ironserengety/MusicRetriever")
|
169 |
+
result = client.predict(
|
170 |
+
message="",
|
171 |
+
api_name="/respond"
|
172 |
+
)
|
173 |
+
llama_responded = 0
|
174 |
+
responded_answer = ""
|
175 |
+
|
176 |
+
elif responded_answer != "" and responded_answer != "SING":
|
177 |
text = responded_answer
|
178 |
|
179 |
client = Client("tonyassi/voice-clone")
|
|
|
185 |
llama_responded = 0
|
186 |
responded_answer = ""
|
187 |
return result
|
188 |
+
|
189 |
def create_interface():
|
190 |
with gr.Blocks() as demo:
|
191 |
|