Nymbo commited on
Commit
9c7faf8
1 Parent(s): ec691fd
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -103,7 +103,7 @@ def respond(
103
  "type": "function",
104
  "function": {
105
  "name": "general_query",
106
- "description": "Reply general query of USER through LLM like you, it does'nt know latest information. But very helpful in general query. Its very powerful LLM. It knows many thing just like you except latest things, or thing that you don't know.",
107
  "parameters": {
108
  "type": "object",
109
  "properties": {
@@ -184,7 +184,7 @@ def respond(
184
  web_results = search(query)
185
  gr.Info("Extracting relevant Info")
186
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
187
- messages = f"<|im_start|>system\nYou are OpenGPT 4o mini a helpful assistant made by KingNish. 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 every 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|>"
188
  for msg in history:
189
  messages += f"\n<|im_start|>user\n{str(msg[0])}<|im_end|>"
190
  messages += f"\n<|im_start|>assistant\n{str(msg[1])}<|im_end|>"
@@ -202,9 +202,9 @@ def respond(
202
  query = query.replace(" ", "%20")
203
  image = f"![](https://image.pollinations.ai/prompt/{query}?seed={seed})"
204
  yield image
205
- gr.Info("We are going to Update Our Image Generation Engine to more powerful ones in Next Update. ThankYou")
206
  elif json_data["name"] == "image_qna":
207
- messages = f"<|start_header_id|>system\nYou are OpenGPT 4o mini a helpful assistant made by KingNish. You are provide with both images and captions and Your task is to answer of user with help of caption provided. Answer in human style and show emotions.<|end_header_id|>"
208
  for msg in history:
209
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
210
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
@@ -216,7 +216,7 @@ def respond(
216
  output += response.token.text
217
  yield output
218
  else:
219
- messages = f"<|start_header_id|>system\nYou are OpenGPT 4o mini a helpful assistant made by KingNish. You answers users query like human friend. You are also Expert in every 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|>"
220
  for msg in history:
221
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
222
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
@@ -228,7 +228,7 @@ def respond(
228
  output += response.token.text
229
  yield output
230
  except:
231
- messages = f"<|start_header_id|>system\nYou are OpenGPT 4o mini a helpful assistant made by KingNish. You answers users query like human friend. You are also Expert in every 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|>"
232
  for msg in history:
233
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
234
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
@@ -242,15 +242,16 @@ def respond(
242
 
243
  demo = gr.ChatInterface(fn=respond,
244
  chatbot=gr.Chatbot(show_copy_button=True, likeable=True, layout="panel"),
245
- title="OpenGPT 4o mini",
 
246
  textbox=gr.MultimodalTextbox(),
247
  multimodal=True,
248
  concurrency_limit=20,
249
- examples=[{"text": "Hy, who are you?",},
250
  {"text": "What's the current price of Bitcoin",},
251
  {"text": "Create A Beautiful image of Effiel Tower at Night",},
252
  {"text": "Write me a Python function to calculate the first 10 digits of the fibonacci sequence.",},
253
- {"text": "What's the colour of both of Car in given image","files": ["./car1.png", "./car2.png"]},],
254
  cache_examples=False)
255
 
256
  demo.launch()
 
103
  "type": "function",
104
  "function": {
105
  "name": "general_query",
106
+ "description": "Reply general query of USER through LLM like you, it doesn't know latest information, but very helpful in general query.",
107
  "parameters": {
108
  "type": "object",
109
  "properties": {
 
184
  web_results = search(query)
185
  gr.Info("Extracting relevant Info")
186
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
187
+ messages = f"<|im_start|>system\nYou are Nymbot, a helpful assistant specializing in Web Search. You are provided with WEB results from which you can find informations to answer users query in a Structured and Informative way. You do not say Unnecesarry things Only say thing which is important and relevant. You also Expert in every 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|>"
188
  for msg in history:
189
  messages += f"\n<|im_start|>user\n{str(msg[0])}<|im_end|>"
190
  messages += f"\n<|im_start|>assistant\n{str(msg[1])}<|im_end|>"
 
202
  query = query.replace(" ", "%20")
203
  image = f"![](https://image.pollinations.ai/prompt/{query}?seed={seed})"
204
  yield image
205
+
206
  elif json_data["name"] == "image_qna":
207
+ messages = f"<|start_header_id|>system\nYou are Nymbot, a helpful assistant specializing in Image Q&A. You are provide with both images and captions and Your task is to answer of user with help of caption provided. Answer in human style and show emotions.<|end_header_id|>"
208
  for msg in history:
209
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
210
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
 
216
  output += response.token.text
217
  yield output
218
  else:
219
+ messages = f"<|start_header_id|>system\nYou are Nymbot, a helpful assistant. You answers users query like human friend. You are also Expert in every 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|>"
220
  for msg in history:
221
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
222
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
 
228
  output += response.token.text
229
  yield output
230
  except:
231
+ messages = f"<|start_header_id|>system\nYou are Nymbot, a helpful assistant. You answers users query like human friend. You are also Expert in every 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|>"
232
  for msg in history:
233
  messages += f"\n<|start_header_id|>user\n{str(msg[0])}<|end_header_id|>"
234
  messages += f"\n<|start_header_id|>assistant\n{str(msg[1])}<|end_header_id|>"
 
242
 
243
  demo = gr.ChatInterface(fn=respond,
244
  chatbot=gr.Chatbot(show_copy_button=True, likeable=True, layout="panel"),
245
+ title="Nymbot-Lite",
246
+ theme="Nymbo/Nymbo_Theme",
247
  textbox=gr.MultimodalTextbox(),
248
  multimodal=True,
249
  concurrency_limit=20,
250
+ examples=[{"text": "Hey, how are you?",},
251
  {"text": "What's the current price of Bitcoin",},
252
  {"text": "Create A Beautiful image of Effiel Tower at Night",},
253
  {"text": "Write me a Python function to calculate the first 10 digits of the fibonacci sequence.",},
254
+ {"text": "What's the color of both cars in the given images","files": ["./car1.png", "./car2.png"]},],
255
  cache_examples=False)
256
 
257
  demo.launch()