Update app.py
Browse files
app.py
CHANGED
@@ -106,7 +106,7 @@ def respond(message, history):
|
|
106 |
]
|
107 |
|
108 |
message_text = message["text"]
|
109 |
-
func_caller.append({"role": "user", "content": f'[SYSTEM]You are a helpful assistant. You have access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> [USER] {message_text}'})
|
110 |
|
111 |
response = client_gemma.chat_completion(func_caller, max_tokens=150)
|
112 |
response = str(response)
|
@@ -129,7 +129,7 @@ def respond(message, history):
|
|
129 |
web_results = search(query)
|
130 |
gr.Info("Extracting relevant Info")
|
131 |
web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
|
132 |
-
messages = f"<|im_start|>system\nYou are
|
133 |
for msg in history:
|
134 |
messages += f"\n<|im_start|>user\n{str(msg[0])}<|im_end|>"
|
135 |
messages += f"\n<|im_start|>assistant\n{str(msg[1])}<|im_end|>"
|
@@ -163,7 +163,7 @@ def respond(message, history):
|
|
163 |
buffer += new_text
|
164 |
yield buffer
|
165 |
else:
|
166 |
-
messages = f"<|start_header_id|>system\nYou are
|
167 |
for msg in history:
|
168 |
messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
|
169 |
messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
|
@@ -175,7 +175,7 @@ def respond(message, history):
|
|
175 |
output += response.token.text
|
176 |
yield output
|
177 |
except:
|
178 |
-
messages = f"<|start_header_id|>system\nYou are
|
179 |
for msg in history:
|
180 |
messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
|
181 |
messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
|
@@ -191,18 +191,16 @@ def respond(message, history):
|
|
191 |
demo = gr.ChatInterface(
|
192 |
fn=respond,
|
193 |
chatbot=gr.Chatbot(show_copy_button=True, likeable=True, layout="panel"),
|
194 |
-
description ="#
|
195 |
textbox=gr.MultimodalTextbox(),
|
196 |
multimodal=True,
|
197 |
concurrency_limit=200,
|
198 |
examples=[
|
199 |
-
{"text": "
|
200 |
-
{"text": "What's the
|
201 |
-
{"text": "
|
202 |
-
{"text": "
|
203 |
-
{"text": "
|
204 |
-
{"text": "What's the colour of car in given image", "files": ["./car1.png"]},
|
205 |
-
{"text": "Read what's written on paper", "files": ["./paper_with_text.png"]},
|
206 |
],
|
207 |
cache_examples=False,
|
208 |
)
|
|
|
106 |
]
|
107 |
|
108 |
message_text = message["text"]
|
109 |
+
func_caller.append({"role": "user", "content": f'[SYSTEM]You are a helpful fashion assistant. You have access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> [USER] {message_text}'})
|
110 |
|
111 |
response = client_gemma.chat_completion(func_caller, max_tokens=150)
|
112 |
response = str(response)
|
|
|
129 |
web_results = search(query)
|
130 |
gr.Info("Extracting relevant Info")
|
131 |
web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
|
132 |
+
messages = f"<|im_start|>system\nYou are a helpful fashion assistant made by Team Star Boys. You are provided with WEB results from which you can find informations to answer users query in Structured and More better way. You do not say Unnecesarry things Only say thing which is important and relevant. You also Expert in fashion and apparel field and also learn and try to answer from contexts related to previous question. Try your best to give best response possible to user. You also try to show emotions using Emojis and reply like human, use short forms, friendly tone and emotions.<|im_end|>"
|
133 |
for msg in history:
|
134 |
messages += f"\n<|im_start|>user\n{str(msg[0])}<|im_end|>"
|
135 |
messages += f"\n<|im_start|>assistant\n{str(msg[1])}<|im_end|>"
|
|
|
163 |
buffer += new_text
|
164 |
yield buffer
|
165 |
else:
|
166 |
+
messages = f"<|start_header_id|>system\nYou are a helpful fashion assistant made by Team Star Boys. You answers users query like human friend. You are also Expert in fashion and apparel field and also learn and try to answer from contexts related to previous question. Try your best to give best response possible to user. You also try to show emotions using Emojis and reply like human, use short forms, friendly tone and emotions.<|end_header_id|>"
|
167 |
for msg in history:
|
168 |
messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
|
169 |
messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
|
|
|
175 |
output += response.token.text
|
176 |
yield output
|
177 |
except:
|
178 |
+
messages = f"<|start_header_id|>system\nYou are a helpful fashion assistant made by Team Star Boys. You answers users query like human friend. You are also Expert in fashion and apparel field and also learn and try to answer from contexts related to previous question. Try your best to give best response possible to user. You also try to show emotions using Emojis and reply like human, use short forms, friendly tone and emotions.<|end_header_id|>"
|
179 |
for msg in history:
|
180 |
messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
|
181 |
messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
|
|
|
191 |
demo = gr.ChatInterface(
|
192 |
fn=respond,
|
193 |
chatbot=gr.Chatbot(show_copy_button=True, likeable=True, layout="panel"),
|
194 |
+
description ="# Lola \n ### Lola can engage in chat, generate images, perform web searches, and Q&A with images.",
|
195 |
textbox=gr.MultimodalTextbox(),
|
196 |
multimodal=True,
|
197 |
concurrency_limit=200,
|
198 |
examples=[
|
199 |
+
{"text": "What cn I wear with a yellow Kurta?",},
|
200 |
+
{"text": "What's the preferred shirt color for an interview?",},
|
201 |
+
{"text": "How can I dress more smartly?",},
|
202 |
+
{"text": "Tell about some good accessories for a traditional Indian wedding",},
|
203 |
+
{"text": "What's the colour of thee frock in the given image?", "files": ["./frock.png"]},
|
|
|
|
|
204 |
],
|
205 |
cache_examples=False,
|
206 |
)
|