Sign inSign up

7499968836/transformer-nl2sparql-model

By 7499968836

•Updated over 2 years ago

Docker image to translate natural language queries to SPARQL queries based on BART model.

Image
Machine learning & AI
0

1.8K

7499968836/transformer-nl2sparql-model repository overview

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.

⁠Define the endpoint and the query

url = "http://localhost:5002/translate⁠" query = { "query": "What are the types of all sensors in Room 5.57?" }

⁠Send the POST request

response = requests.post(url, headers={"Content-Type": "application/json"}, data=json.dumps(query))

⁠Check the response status code and print the response

if response.status_code == 200: print("SPARQL Query:", response.json().get("sparql_query")) else: print(f"Error: {response.status_code}") print(response.text)

⁠Or

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?"}'

Tag summary

Content type

Image

Digest

sha256:e4a1681bb…

Size

4.2 GB

Last updated

over 2 years ago

docker pull 7499968836/transformer-nl2sparql-model