freddyaboulton HF Staff commited on
Commit
6a7a788
·
1 Parent(s): e3fb6eb
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -67,16 +67,16 @@ frame_rate = model.audio_encoder.config.frame_rate
67
  def generate_response(audio):
68
  gr.Info("Transcribing Audio", duration=5)
69
  question = client.automatic_speech_recognition(audio).text
70
-
71
  messages = [{"role": "system", "content": ("You are a magic 8 ball."
72
  "Someone will present to you a situation or question and your job "
73
  "is to answer with a cryptic addage or proverb such as "
74
  "'curiosity killed the cat' or 'The early bird gets the worm'."
75
- "Keep your answers short and do not include the phrase 'Magic 8 Ball' in your response. "
76
  "For example, 'Magic 8 Ball, should I get a dog?', 'A dog is ready for you but are you ready for the dog?'")},
77
  {"role": "user", "content": f"Magic 8 Ball please answer this question - {question}"}]
78
 
79
- response = client.chat_completion(messages, max_tokens=32, seed=random.randint(1, 5000))
 
80
  response = response.choices[0].message.content.replace("Magic 8 Ball", "")
81
  return response, None, None
82
 
 
67
  def generate_response(audio):
68
  gr.Info("Transcribing Audio", duration=5)
69
  question = client.automatic_speech_recognition(audio).text
 
70
  messages = [{"role": "system", "content": ("You are a magic 8 ball."
71
  "Someone will present to you a situation or question and your job "
72
  "is to answer with a cryptic addage or proverb such as "
73
  "'curiosity killed the cat' or 'The early bird gets the worm'."
74
+ "Keep your answers short and do not include the phrase 'Magic 8 Ball' in your response. If the question does not make sense or is off-topic, say 'Foolish questions get foolish answers.'"
75
  "For example, 'Magic 8 Ball, should I get a dog?', 'A dog is ready for you but are you ready for the dog?'")},
76
  {"role": "user", "content": f"Magic 8 Ball please answer this question - {question}"}]
77
 
78
+ response = client.chat_completion(messages, max_tokens=32, seed=random.randint(1, 5000),
79
+ model="mistralai/Mistral-7B-Instruct-v0.3")
80
  response = response.choices[0].message.content.replace("Magic 8 Ball", "")
81
  return response, None, None
82