Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ if torch.cuda.is_available():
|
|
42 |
def prompt_template(materiali, query):
|
43 |
mat = ''
|
44 |
for i, doc in enumerate(materiali):
|
45 |
-
mat += f
|
46 |
prompt_template = f"""
|
47 |
Basandoti sulle tue conoscenze e usando le informazioni che ti fornisco di seguito.
|
48 |
CONTESTO:
|
@@ -64,9 +64,9 @@ def richiamo_materiali(query, vett_query, alpha=1.0, N_items=5):
|
|
64 |
fusion_type=HybridFusion.RELATIVE_SCORE,
|
65 |
).with_additional(["score"]).with_limit(N_items).do()
|
66 |
|
67 |
-
mat = [{
|
68 |
except:
|
69 |
-
mat =[{
|
70 |
|
71 |
return mat
|
72 |
|
|
|
42 |
def prompt_template(materiali, query):
|
43 |
mat = ''
|
44 |
for i, doc in enumerate(materiali):
|
45 |
+
mat += f"""DOCUMENTO {i+1}: {doc["contenuto"]};\n"""
|
46 |
prompt_template = f"""
|
47 |
Basandoti sulle tue conoscenze e usando le informazioni che ti fornisco di seguito.
|
48 |
CONTESTO:
|
|
|
64 |
fusion_type=HybridFusion.RELATIVE_SCORE,
|
65 |
).with_additional(["score"]).with_limit(N_items).do()
|
66 |
|
67 |
+
mat = [{"score":i["_additional"]["score"],'contenuto':i["content"]} for i in materiali["data"]["Get"]["Default"]]
|
68 |
except:
|
69 |
+
mat =[{"score":0, "contenuto":'NESSUN MATERIALE FORNITO'}]
|
70 |
|
71 |
return mat
|
72 |
|