GitLab CI commited on
Commit
9254534
·
1 Parent(s): 45ab685

Update game build from GitLab CI

Browse files
server/ActionProcessor.py CHANGED
@@ -5,7 +5,7 @@ import json
5
  import re
6
  import logging
7
  import sys
8
- from mistralai.client import MistralClient
9
 
10
  # Configure logging
11
  logging.basicConfig(
@@ -27,21 +27,25 @@ class ActionProcessor(Thread):
27
  super().__init__()
28
  self.text_queue = text_queue
29
  self.action_queue = action_queue
30
- self.mistral_client = MistralClient(api_key=mistral_api_key)
31
  self.daemon = True # Thread will exit when main program exits
32
 
33
  def get_sentiment(self, input_text: str) -> str:
34
  """Get sentiment analysis for input text."""
35
- messages=[{
36
- "role": "user",
37
- "content": f"""You are a sentiment classifier of positive or negative parenting.
 
38
  Classify the following sentence, output "negative" or "positive", do not justify:
39
  "{input_text}"
40
- """,},]
 
 
41
  response = self.mistral_client.chat.complete(
42
- model="mistral-large-latest",
43
- messages=messages,
44
  )
 
45
  result = response.choices[0].message.content
46
 
47
  return result.strip()
 
5
  import re
6
  import logging
7
  import sys
8
+ from mistralai import Mistral
9
 
10
  # Configure logging
11
  logging.basicConfig(
 
27
  super().__init__()
28
  self.text_queue = text_queue
29
  self.action_queue = action_queue
30
+ self.mistral_client = Mistral(api_key=mistral_api_key)
31
  self.daemon = True # Thread will exit when main program exits
32
 
33
  def get_sentiment(self, input_text: str) -> str:
34
  """Get sentiment analysis for input text."""
35
+ messages = [
36
+ {
37
+ "role": "user",
38
+ "content": f"""You are a sentiment classifier of positive or negative parenting.
39
  Classify the following sentence, output "negative" or "positive", do not justify:
40
  "{input_text}"
41
+ """,
42
+ },
43
+ ]
44
  response = self.mistral_client.chat.complete(
45
+ model="mistral-large-latest",
46
+ messages=messages,
47
  )
48
+
49
  result = response.choices[0].message.content
50
 
51
  return result.strip()
server/AudioTranscriber.py CHANGED
@@ -25,13 +25,13 @@ class AudioTranscriber(threading.Thread):
25
  audio_queue: "Queue[io.BytesIO]",
26
  text_queue: "Queue[str]",
27
  language: str = "en",
28
- confidence_threshold: float = -0.5,
29
  ):
30
  super().__init__()
31
  self.audio_queue = audio_queue
32
  self.action_queue = text_queue
33
  self.daemon = True # Thread will exit when main program exits
34
- self.max_buffer_size = 3
35
  self.language = language
36
  self.confidence_threshold = confidence_threshold
37
  self.buffer: List[io.BytesIO] = []
@@ -63,7 +63,7 @@ class AudioTranscriber(threading.Thread):
63
 
64
  # Put the transcription results in the output queue
65
  for segment in segments:
66
- if segment.avg_logprob <= self.confidence_threshold:
67
  self.action_queue.put(segment.text)
68
  # Still print for debugging
69
  logger.info(
 
25
  audio_queue: "Queue[io.BytesIO]",
26
  text_queue: "Queue[str]",
27
  language: str = "en",
28
+ confidence_threshold: float = 0.5,
29
  ):
30
  super().__init__()
31
  self.audio_queue = audio_queue
32
  self.action_queue = text_queue
33
  self.daemon = True # Thread will exit when main program exits
34
+ self.max_buffer_size = 5
35
  self.language = language
36
  self.confidence_threshold = confidence_threshold
37
  self.buffer: List[io.BytesIO] = []
 
63
 
64
  # Put the transcription results in the output queue
65
  for segment in segments:
66
+ if segment.no_speech_prob <= self.confidence_threshold:
67
  self.action_queue.put(segment.text)
68
  # Still print for debugging
69
  logger.info(
server/__main__.py CHANGED
@@ -24,7 +24,11 @@ logging.basicConfig(
24
  logger = logging.getLogger(__name__)
25
 
26
  # Use a directory in the user's home folder for static files
27
- STATIC_DIR = "/app/server/static" if os.getenv("DEBUG") != "true" else "./server"
 
 
 
 
28
 
29
  audio_queue: "Queue[io.BytesIO]" = Queue()
30
  text_queue: "Queue[str]" = Queue()
 
24
  logger = logging.getLogger(__name__)
25
 
26
  # Use a directory in the user's home folder for static files
27
+ STATIC_DIR = (
28
+ "/app/server/static"
29
+ if os.getenv("DEBUG") != "true"
30
+ else "/home/gab/work/gogogo/html"
31
+ )
32
 
33
  audio_queue: "Queue[io.BytesIO]" = Queue()
34
  text_queue: "Queue[str]" = Queue()
server/static/godot/index.pck CHANGED
Binary files a/server/static/godot/index.pck and b/server/static/godot/index.pck differ