Pijush2023 commited on
Commit
54c6fcd
·
verified ·
1 Parent(s): c376175

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -87,15 +87,33 @@ def transcribe_function(stream, new_chunk):
87
 
88
  return stream, full_text, full_text
89
 
 
 
 
 
 
 
 
 
 
 
90
  # Function to generate a full-text search query for Neo4j
91
  def generate_full_text_query(input: str) -> str:
92
- full_text_query = ""
93
  words = [el for el in input.split() if el]
 
 
 
 
 
 
 
94
  for word in words[:-1]:
95
  full_text_query += f" {word}~2 AND"
96
  full_text_query += f" {words[-1]}~2"
97
  return full_text_query.strip()
98
 
 
99
  # Function to generate audio with Eleven Labs TTS
100
  def generate_audio_elevenlabs(text):
101
  XI_API_KEY = os.environ['ELEVENLABS_API']
 
87
 
88
  return stream, full_text, full_text
89
 
90
+ # Function to generate a full-text search query for Neo4j
91
+ #def generate_full_text_query(input: str) -> str:
92
+ #full_text_query = ""
93
+ #words = [el for el in input.split() if el]
94
+ #for word in words[:-1]:
95
+ #full_text_query += f" {word}~2 AND"
96
+ #full_text_query += f" {words[-1]}~2"
97
+ #return full_text_query.strip()
98
+
99
+
100
  # Function to generate a full-text search query for Neo4j
101
  def generate_full_text_query(input: str) -> str:
102
+ # Split the input into words, ignoring any empty strings
103
  words = [el for el in input.split() if el]
104
+
105
+ # Check if there are no words
106
+ if not words:
107
+ return "" # Return an empty string or a default query if desired
108
+
109
+ # Create the full-text query with fuzziness (~2 for proximity search)
110
+ full_text_query = ""
111
  for word in words[:-1]:
112
  full_text_query += f" {word}~2 AND"
113
  full_text_query += f" {words[-1]}~2"
114
  return full_text_query.strip()
115
 
116
+
117
  # Function to generate audio with Eleven Labs TTS
118
  def generate_audio_elevenlabs(text):
119
  XI_API_KEY = os.environ['ELEVENLABS_API']