Spaces:
Sleeping
Sleeping
stivenDR14
commited on
Commit
路
b469fbd
1
Parent(s):
6693c55
update json task and embeding model
Browse files- app.py +1 -1
- pdf_processor.py +19 -1
app.py
CHANGED
|
@@ -166,8 +166,8 @@ class PDFProcessorUI:
|
|
| 166 |
label=TRANSLATIONS[self.current_language]["mini_analysis_title"],
|
| 167 |
lines=10
|
| 168 |
)
|
| 169 |
-
specialist_btn = gr.Button(TRANSLATIONS[self.current_language]["specialist_btn"])
|
| 170 |
specialist_output = gr.Textbox(label=TRANSLATIONS[self.current_language]["specialist_output"], lines=20)
|
|
|
|
| 171 |
|
| 172 |
|
| 173 |
language_dropdown.change(
|
|
|
|
| 166 |
label=TRANSLATIONS[self.current_language]["mini_analysis_title"],
|
| 167 |
lines=10
|
| 168 |
)
|
|
|
|
| 169 |
specialist_output = gr.Textbox(label=TRANSLATIONS[self.current_language]["specialist_output"], lines=20)
|
| 170 |
+
specialist_btn = gr.Button(TRANSLATIONS[self.current_language]["specialist_btn"])
|
| 171 |
|
| 172 |
|
| 173 |
language_dropdown.change(
|
pdf_processor.py
CHANGED
|
@@ -17,6 +17,7 @@ import chromadb
|
|
| 17 |
import requests
|
| 18 |
import os
|
| 19 |
from dotenv import load_dotenv
|
|
|
|
| 20 |
|
| 21 |
OLLAMA_LLM = "granite3.1-dense"
|
| 22 |
OLLAMA_EMBEDDINGS = "granite-embedding:278m"
|
|
@@ -147,7 +148,7 @@ class PDFProcessor:
|
|
| 147 |
temperature=0.2,
|
| 148 |
)
|
| 149 |
embeding_model = HuggingFaceEmbeddings(
|
| 150 |
-
model_name="ibm-granite/granite-embedding-
|
| 151 |
)
|
| 152 |
return current_llm, embeding_model
|
| 153 |
|
|
@@ -325,6 +326,14 @@ class PDFProcessor:
|
|
| 325 |
|
| 326 |
print(questions)
|
| 327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
questions = json.loads(questions)
|
| 329 |
|
| 330 |
print(questions)
|
|
@@ -349,6 +358,15 @@ class PDFProcessor:
|
|
| 349 |
|
| 350 |
Basado en lo que analices, proporciona una evaluaci贸n legal detallada """
|
| 351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
""" Act煤a como un asesor e ingeniero financiero experto en lectura de reportes y an谩lisis de datos.
|
| 353 |
|
| 354 |
Basado en los datos y conclusiones del reporte, proporciona una evaluaci贸n financiera detallada y posibles escenarios tanto negativos como positivos que se puedan presentar.
|
|
|
|
| 17 |
import requests
|
| 18 |
import os
|
| 19 |
from dotenv import load_dotenv
|
| 20 |
+
import re
|
| 21 |
|
| 22 |
OLLAMA_LLM = "granite3.1-dense"
|
| 23 |
OLLAMA_EMBEDDINGS = "granite-embedding:278m"
|
|
|
|
| 148 |
temperature=0.2,
|
| 149 |
)
|
| 150 |
embeding_model = HuggingFaceEmbeddings(
|
| 151 |
+
model_name="ibm-granite/granite-embedding-107m-multilingual",
|
| 152 |
)
|
| 153 |
return current_llm, embeding_model
|
| 154 |
|
|
|
|
| 326 |
|
| 327 |
print(questions)
|
| 328 |
|
| 329 |
+
# Usar una expresi贸n regular para extraer el JSON
|
| 330 |
+
match = re.search(r'\{.*\}', questions, re.DOTALL)
|
| 331 |
+
if match:
|
| 332 |
+
questions = match.group(0)
|
| 333 |
+
else:
|
| 334 |
+
raise ValueError("No valid JSON found in the response")
|
| 335 |
+
|
| 336 |
+
questions = questions.strip()
|
| 337 |
questions = json.loads(questions)
|
| 338 |
|
| 339 |
print(questions)
|
|
|
|
| 358 |
|
| 359 |
Basado en lo que analices, proporciona una evaluaci贸n legal detallada """
|
| 360 |
|
| 361 |
+
""" Eres profesional en gerencia de proyectos y tienes una amplia experiencia en la creaci贸n, direcci贸n y ejecuci贸n de proyectos de tecnologia.
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
- Basa tu analisis en los objetivos el proyecto, el nicho en que se enfocan y su propuesta de valor.
|
| 365 |
+
- Ofrece un argumento estructurado y recomendaciones pr谩cticas en base a otros posibles nichos y soluciones relacionadas.
|
| 366 |
+
- Mant茅n un tono profesional, preciso y fundamentado.
|
| 367 |
+
Basado en el documento y tu experiencia, proporciona una evaluaci贸n detallada de los proyectos y actividades que se analizaron.
|
| 368 |
+
"""
|
| 369 |
+
|
| 370 |
""" Act煤a como un asesor e ingeniero financiero experto en lectura de reportes y an谩lisis de datos.
|
| 371 |
|
| 372 |
Basado en los datos y conclusiones del reporte, proporciona una evaluaci贸n financiera detallada y posibles escenarios tanto negativos como positivos que se puedan presentar.
|