updated the context/history
Browse files
app.py
CHANGED
|
@@ -34,12 +34,12 @@ class CancerApp:
|
|
| 34 |
|
| 35 |
def text_to_speech(self, message, output_filename, Saved_response=""):
|
| 36 |
search_results = self.vectorstore.search_vectorstore(message, 5)
|
| 37 |
-
query = Saved_response
|
| 38 |
for i, result in enumerate(search_results, 1):
|
| 39 |
query += f"\n{i}. {result}"
|
| 40 |
|
| 41 |
try:
|
| 42 |
-
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", query)
|
| 43 |
except Exception as e:
|
| 44 |
print("Gemini error:", e)
|
| 45 |
gemini_response = f"Error: {str(e)}"
|
|
@@ -53,11 +53,11 @@ class CancerApp:
|
|
| 53 |
def speech_to_speech(self, audiofile_path, output_filename, Saved_response=""):
|
| 54 |
transcription = self.audio_processor.transcribe_audio(audiofile_path, language="en")
|
| 55 |
search_results = self.vectorstore.search_vectorstore(transcription, 5)
|
| 56 |
-
query = Saved_response
|
| 57 |
for i, result in enumerate(search_results, 1):
|
| 58 |
query += f"\n{i}. {result}"
|
| 59 |
try:
|
| 60 |
-
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", query)
|
| 61 |
except Exception as e:
|
| 62 |
print("Gemini error:", e)
|
| 63 |
gemini_response = f"Error: {str(e)}"
|
|
@@ -85,13 +85,13 @@ class CancerApp:
|
|
| 85 |
print(f"Vectorstore search error: {ex}")
|
| 86 |
search_results = []
|
| 87 |
|
| 88 |
-
query = f"{Saved_response}
|
| 89 |
for i, result in enumerate(search_results, 1):
|
| 90 |
query += f"\n{i}. {result}"
|
| 91 |
|
| 92 |
|
| 93 |
try:
|
| 94 |
-
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", query)
|
| 95 |
gemini_response = remove_stars(gemini_response)
|
| 96 |
except Exception as e:
|
| 97 |
print("Gemini error:", e)
|
|
@@ -103,12 +103,12 @@ class CancerApp:
|
|
| 103 |
|
| 104 |
def text_to_text(self, message, Saved_response=""):
|
| 105 |
search_results = self.vectorstore.search_vectorstore(message, 5)
|
| 106 |
-
query = Saved_response
|
| 107 |
for i, result in enumerate(search_results, 1):
|
| 108 |
query += f"\n{i}. {result}"
|
| 109 |
|
| 110 |
try:
|
| 111 |
-
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17",
|
| 112 |
gemini_response = remove_stars(gemini_response)
|
| 113 |
except Exception as e:
|
| 114 |
print("Gemini error:", e)
|
|
|
|
| 34 |
|
| 35 |
def text_to_speech(self, message, output_filename, Saved_response=""):
|
| 36 |
search_results = self.vectorstore.search_vectorstore(message, 5)
|
| 37 |
+
query = Saved_response
|
| 38 |
for i, result in enumerate(search_results, 1):
|
| 39 |
query += f"\n{i}. {result}"
|
| 40 |
|
| 41 |
try:
|
| 42 |
+
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", message, query)
|
| 43 |
except Exception as e:
|
| 44 |
print("Gemini error:", e)
|
| 45 |
gemini_response = f"Error: {str(e)}"
|
|
|
|
| 53 |
def speech_to_speech(self, audiofile_path, output_filename, Saved_response=""):
|
| 54 |
transcription = self.audio_processor.transcribe_audio(audiofile_path, language="en")
|
| 55 |
search_results = self.vectorstore.search_vectorstore(transcription, 5)
|
| 56 |
+
query = Saved_response
|
| 57 |
for i, result in enumerate(search_results, 1):
|
| 58 |
query += f"\n{i}. {result}"
|
| 59 |
try:
|
| 60 |
+
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", transcription, query)
|
| 61 |
except Exception as e:
|
| 62 |
print("Gemini error:", e)
|
| 63 |
gemini_response = f"Error: {str(e)}"
|
|
|
|
| 85 |
print(f"Vectorstore search error: {ex}")
|
| 86 |
search_results = []
|
| 87 |
|
| 88 |
+
query = f"{Saved_response}"
|
| 89 |
for i, result in enumerate(search_results, 1):
|
| 90 |
query += f"\n{i}. {result}"
|
| 91 |
|
| 92 |
|
| 93 |
try:
|
| 94 |
+
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17", transcription,query)
|
| 95 |
gemini_response = remove_stars(gemini_response)
|
| 96 |
except Exception as e:
|
| 97 |
print("Gemini error:", e)
|
|
|
|
| 103 |
|
| 104 |
def text_to_text(self, message, Saved_response=""):
|
| 105 |
search_results = self.vectorstore.search_vectorstore(message, 5)
|
| 106 |
+
query = Saved_response
|
| 107 |
for i, result in enumerate(search_results, 1):
|
| 108 |
query += f"\n{i}. {result}"
|
| 109 |
|
| 110 |
try:
|
| 111 |
+
gemini_response = self.llm_processor.call_gemini_llm("gemini-2.5-flash-preview-04-17",message,query)
|
| 112 |
gemini_response = remove_stars(gemini_response)
|
| 113 |
except Exception as e:
|
| 114 |
print("Gemini error:", e)
|