C2MV commited on
Commit
7b1af97
·
verified ·
1 Parent(s): 0eb2d4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -8,6 +8,13 @@ from config import SIMILARITY_THRESHOLD_DEFAULT, SYSTEM_PROMPT, MAX_LENGTH_DEFAU
8
  from decorators import gpu_decorator
9
  import torch
10
 
 
 
 
 
 
 
 
11
  # Cargar modelos
12
  embedding_model = load_embedding_model()
13
  tokenizer, yi_coder_model, yi_coder_device = load_yi_coder_model()
@@ -90,11 +97,15 @@ def process_input(message, history, selected_option, similarity_threshold, syste
90
  history.append((message, response))
91
  return history, history, image
92
 
93
- def update_image(image_url):
94
- if image_url:
95
- return image_url
96
- else:
97
- return None
 
 
 
 
98
 
99
  def send_preset_question(question, history, selected_option, similarity_threshold, system_prompt, max_length):
100
  return process_input(question, history, selected_option, similarity_threshold, system_prompt, max_length)
 
8
  from decorators import gpu_decorator
9
  import torch
10
 
11
+ ########################
12
+
13
+ from utils import process_tags_chat
14
+
15
+ ########################
16
+
17
+
18
  # Cargar modelos
19
  embedding_model = load_embedding_model()
20
  tokenizer, yi_coder_model, yi_coder_device = load_yi_coder_model()
 
97
  history.append((message, response))
98
  return history, history, image
99
 
100
+ def update_image(message, history):
101
+ # Realizar búsqueda vectorial
102
+ search_results = vector_search(message, embedding_model, index)
103
+
104
+ # Llamar a process_tags_chat para procesar los resultados y obtener la imagen
105
+ full_response, image_url = process_tags_chat(search_results)
106
+
107
+ return image_url if image_url else None
108
+
109
 
110
  def send_preset_question(question, history, selected_option, similarity_threshold, system_prompt, max_length):
111
  return process_input(question, history, selected_option, similarity_threshold, system_prompt, max_length)