Pijush2023 commited on
Commit
f684fa1
·
verified ·
1 Parent(s): 4873ba5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -10,6 +10,7 @@ from langchain_community.vectorstores.neo4j_vector import remove_lucene_chars
10
  from langchain_community.graphs import Neo4jGraph
11
  from langchain_experimental.graph_transformers import LLMGraphTransformer
12
  from langchain_core.prompts import ChatPromptTemplate
 
13
 
14
  # Neo4j setup
15
  graph = Neo4jGraph(
@@ -18,6 +19,16 @@ graph = Neo4jGraph(
18
  password="_x8f-_aAQvs2NB0x6s0ZHSh3W_y-HrENDbgStvsUCM0"
19
  )
20
 
 
 
 
 
 
 
 
 
 
 
21
  # Define the ASR model with Whisper
22
  model_id = 'openai/whisper-large-v3'
23
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
@@ -174,4 +185,4 @@ interface = gr.Interface(
174
  )
175
 
176
  # Launch the Gradio app
177
- interface.launch()
 
10
  from langchain_community.graphs import Neo4jGraph
11
  from langchain_experimental.graph_transformers import LLMGraphTransformer
12
  from langchain_core.prompts import ChatPromptTemplate
13
+ import time
14
 
15
  # Neo4j setup
16
  graph = Neo4jGraph(
 
19
  password="_x8f-_aAQvs2NB0x6s0ZHSh3W_y-HrENDbgStvsUCM0"
20
  )
21
 
22
+
23
+ # Function to generate a full-text search query for Neo4j
24
+ def generate_full_text_query(input: str) -> str:
25
+ full_text_query = ""
26
+ words = [el for el in input.split() if el]
27
+ for word in words[:-1]:
28
+ full_text_query += f" {word}~2 AND"
29
+ full_text_query += f" {words[-1]}~2"
30
+ return full_text_query.strip()
31
+
32
  # Define the ASR model with Whisper
33
  model_id = 'openai/whisper-large-v3'
34
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
 
185
  )
186
 
187
  # Launch the Gradio app
188
+ interface.launch(show_error=True)