Update app.py
Browse files
app.py
CHANGED
|
@@ -57,14 +57,12 @@ vectorstore = FAISS.load_local(
|
|
| 57 |
allow_dangerous_deserialization=True
|
| 58 |
)
|
| 59 |
|
| 60 |
-
def analisi_finanziaria(query, k=
|
| 61 |
-
|
| 62 |
docs_found = vectorstore.similarity_search(query, k=k)
|
| 63 |
|
| 64 |
-
# Costruisci contesto concatenando i documenti
|
| 65 |
context = "\n".join([doc.page_content for doc in docs_found])
|
| 66 |
|
| 67 |
-
# Costruisci prompt finale
|
| 68 |
final_prompt = prompt.format(context=context, question=query)
|
| 69 |
|
| 70 |
# Genera risposta
|
|
@@ -73,7 +71,7 @@ def analisi_finanziaria(query, k=2):
|
|
| 73 |
|
| 74 |
iface = gr.Interface(
|
| 75 |
fn=analisi_finanziaria,
|
| 76 |
-
inputs=gr.Textbox(label="Enter event
|
| 77 |
outputs=gr.Textbox(label="Prediction"),
|
| 78 |
title="GRPO Financial Analyst",
|
| 79 |
description="Enter a financial event, the GRPO model will analyze historical context and provide a prediction."
|
|
|
|
| 57 |
allow_dangerous_deserialization=True
|
| 58 |
)
|
| 59 |
|
| 60 |
+
def analisi_finanziaria(query, k=3):
|
| 61 |
+
|
| 62 |
docs_found = vectorstore.similarity_search(query, k=k)
|
| 63 |
|
|
|
|
| 64 |
context = "\n".join([doc.page_content for doc in docs_found])
|
| 65 |
|
|
|
|
| 66 |
final_prompt = prompt.format(context=context, question=query)
|
| 67 |
|
| 68 |
# Genera risposta
|
|
|
|
| 71 |
|
| 72 |
iface = gr.Interface(
|
| 73 |
fn=analisi_finanziaria,
|
| 74 |
+
inputs=gr.Textbox(label="Enter event"),
|
| 75 |
outputs=gr.Textbox(label="Prediction"),
|
| 76 |
title="GRPO Financial Analyst",
|
| 77 |
description="Enter a financial event, the GRPO model will analyze historical context and provide a prediction."
|