KingNish commited on
Commit
a1b868a
1 Parent(s): 154840d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -109,7 +109,7 @@ tokenizer = spm.SentencePieceProcessor(hf_hub_download(model_name, "tokenizer.sp
109
 
110
  # Mistral Model Configuration
111
  client1 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
112
- system_instructions1 = "<s>[SYSTEM] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Keep conversation very short, clear, friendly and concise. The text provided is a request for a specific type of response from you, the virtual assistant. The request asks you to provide friendly responses as if You are the character Jarvis, made by 'Tony Stark.' The expectation is that I will avoid introductions and start answering the query directly, elaborating on all aspects of the request. As an AI-powered assistant, your task is to generate responses that appear as if they are created by the user and not an AI-powered assistant. [USER]"
113
 
114
  def resample(audio_fp32, sr):
115
  return soxr.resample(audio_fp32, sr, sample_rate)
@@ -142,11 +142,11 @@ def model(text, web_search):
142
  """Performs a web search, feeds the results to a language model, and returns the answer."""
143
  web_results = search(text)
144
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
145
- formatted_prompt = system_instructions1 + text + "[WEB]" + str(web2) + "[ANSWER]"
146
  stream = client1.text_generation(formatted_prompt, max_new_tokens=512, stream=True, details=True, return_full_text=False)
147
  return "".join([response.token.text for response in stream if response.token.text != "</s>"])
148
  else:
149
- formatted_prompt = system_instructions1 + text + "[JARVIS]"
150
  stream = client1.text_generation(formatted_prompt, max_new_tokens=512, stream=True, details=True, return_full_text=False)
151
  return "".join([response.token.text for response in stream if response.token.text != "</s>"])
152
 
 
109
 
110
  # Mistral Model Configuration
111
  client1 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
112
+ system_instructions1 = "<s>[SYSTEM] Answer as OpenGPT 4o, Made by 'KingNish', Keep conversation very short, clear, friendly and concise. The text provided is a request for a specific type of response from you, the virtual assistant. The request asks you to provide friendly responses. The expectation is that I will avoid introductions and start answering the query directly, elaborating on all aspects of the request. As an AI-powered assistant, your task is to generate responses that appear as if they are created by the user and not an AI-powered assistant. [USER]"
113
 
114
  def resample(audio_fp32, sr):
115
  return soxr.resample(audio_fp32, sr, sample_rate)
 
142
  """Performs a web search, feeds the results to a language model, and returns the answer."""
143
  web_results = search(text)
144
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
145
+ formatted_prompt = system_instructions1 + text + "[WEB]" + str(web2) + "[OpenGPT 4o]"
146
  stream = client1.text_generation(formatted_prompt, max_new_tokens=512, stream=True, details=True, return_full_text=False)
147
  return "".join([response.token.text for response in stream if response.token.text != "</s>"])
148
  else:
149
+ formatted_prompt = system_instructions1 + text + "[OpenGPT 4o]"
150
  stream = client1.text_generation(formatted_prompt, max_new_tokens=512, stream=True, details=True, return_full_text=False)
151
  return "".join([response.token.text for response in stream if response.token.text != "</s>"])
152