Docker image to translate natural language queries to SPARQL queries based on BART model.
1.8K
This Docker image contain a Transformer model based on BART which is trained to generate SPARQL queries from Natural Language. Use docker-compose to term on the service and expose port 5002. Port 5002 can be used as a interactive page to send natural language queries and to get the SPARQL queries. We have used flask app to route the endpoint where you give get the json response from any requests send to the endpoint.
url = "http://localhost:5002/translate" query = { "query": "What are the types of all sensors in Room 5.57?" }
response = requests.post(url, headers={"Content-Type": "application/json"}, data=json.dumps(query))
if response.status_code == 200: print("SPARQL Query:", response.json().get("sparql_query")) else: print(f"Error: {response.status_code}") print(response.text)
Use Curl to receive a response from trained model.
curl -X POST http://localhost:5000/translate -H "Content-Type: application/json" -d '{"query": "Where is airq5.69 located?"}'
Content type
Image
Digest
sha256:e4a1681bb…
Size
4.2 GB
Last updated
over 2 years ago
docker pull 7499968836/transformer-nl2sparql-model