Update app.py
Browse files
app.py
CHANGED
|
@@ -94,13 +94,12 @@ async def generate_query(request: QueryRequest):
|
|
| 94 |
if not is_valid:
|
| 95 |
raise HTTPException(status_code=400, detail="La query generata non è valida rispetto al file RDF fornito.")
|
| 96 |
|
| 97 |
-
|
| 98 |
-
explanation = f"La query generata è: {response.replace('\\n', ' ').strip()}. "
|
| 99 |
explanation += "Questa query è stata progettata per estrarre informazioni specifiche dai dati RDF, consentendo di rispondere alla tua domanda. Risultati ottenuti da questa query possono includere dettagli come entità, relazioni o attributi collegati al contesto fornito."
|
| 100 |
|
| 101 |
-
return {"query": response.replace("
|
| 102 |
|
| 103 |
# Endpoint per verificare se il server è attivo
|
| 104 |
@app.get("/")
|
| 105 |
async def root():
|
| 106 |
-
return {"message": "Il server è attivo e pronto a generare query SPARQL!"}
|
|
|
|
| 94 |
if not is_valid:
|
| 95 |
raise HTTPException(status_code=400, detail="La query generata non è valida rispetto al file RDF fornito.")
|
| 96 |
|
| 97 |
+
explanation = "La query generata è: " + response.replace("\n", " ").strip() + ". "
|
|
|
|
| 98 |
explanation += "Questa query è stata progettata per estrarre informazioni specifiche dai dati RDF, consentendo di rispondere alla tua domanda. Risultati ottenuti da questa query possono includere dettagli come entità, relazioni o attributi collegati al contesto fornito."
|
| 99 |
|
| 100 |
+
return {"query": response.replace("\n", " ").strip(), "explanation": explanation}
|
| 101 |
|
| 102 |
# Endpoint per verificare se il server è attivo
|
| 103 |
@app.get("/")
|
| 104 |
async def root():
|
| 105 |
+
return {"message": "Il server è attivo e pronto a generare query SPARQL!"}
|