Skip to content
Snippets Groups Projects
Commit c32ff670 authored by Fize Jacques's avatar Fize Jacques
Browse files

update server app + add img

parent e17375c8
No related branches found
No related tags found
No related merge requests found
documentation/imgs/LSTM_arch.png

19.4 KiB | W: | H:

documentation/imgs/LSTM_arch.png

130 B | W: | H:

documentation/imgs/LSTM_arch.png
documentation/imgs/LSTM_arch.png
documentation/imgs/LSTM_arch.png
documentation/imgs/LSTM_arch.png
  • 2-up
  • Swipe
  • Onion skin
documentation/imgs/first_approach.png

291 KiB | W: | H:

documentation/imgs/first_approach.png

131 B | W: | H:

documentation/imgs/first_approach.png
documentation/imgs/first_approach.png
documentation/imgs/first_approach.png
documentation/imgs/first_approach.png
  • 2-up
  • Swipe
  • Onion skin
documentation/imgs/second_approach.png

447 KiB | W: | H:

documentation/imgs/second_approach.png

131 B | W: | H:

documentation/imgs/second_approach.png
documentation/imgs/second_approach.png
documentation/imgs/second_approach.png
documentation/imgs/second_approach.png
  • 2-up
  • Swipe
  • Onion skin
documentation/imgs/third_approach.png

30.4 KiB | W: | H:

documentation/imgs/third_approach.png

130 B | W: | H:

documentation/imgs/third_approach.png
documentation/imgs/third_approach.png
documentation/imgs/third_approach.png
documentation/imgs/third_approach.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -3,6 +3,7 @@ import os
# DATA LIB
import numpy as np
import pandas as pd
# DL LIB
import tensorflow as tf
......@@ -82,7 +83,7 @@ def heuritic_mean(geocoder,data):
toponyms = data.text.unique()
input_ = np.asarray([[t1,t2] for t2 in toponyms for t1 in toponyms if t2 != t1])
res_geocode = pd.DataFrame(input_,columns="t tc".split())
lons,lats = geocoder.get_coords(input_[:,0],input_[:,1])
lons,lats = geocoder.wgs_coord(*geocoder.get_coords(input_[:,0],input_[:,1]))
res_geocode["lon"] = lons
res_geocode["lat"] = lats
results = {}
......@@ -97,7 +98,7 @@ class TextGeocoder():
self.geocoder_model = geocoder_model
self.ner_name = ner_name
self.ner_model = None
if self.ner == "stanza":
if self.ner_name == "stanza":
self.ner_model = stanza.Pipeline(lang)
else:
self.ner_model = spacy.load(lang)
......@@ -114,5 +115,7 @@ class TextGeocoder():
def geocode(self,entities):
df = pd.DataFrame(entities)
results = self.heuristic_func(self.geocoder_model,df)
return results
heuristic_results = self.heuristic_func(self.geocoder_model,df)
for e in range(len(entities)):
entities[e]["coord"] = heuristic_results[entities[e]["text"]]
return entities
from flask import Flask, escape, request, render_template
from lib.geocoder import Geocoder
#from lib.geocoder import Geocoder
geocoder = Geocoder("./outputs/GB_MODEL_2/GB.txt_100_4_100__A_I_C.h5","./outputs/GB_MODEL_2/GB.txt_100_4_100__A_I_C_index")
geocoder = None#Geocoder("./outputs/GB_MODEL_2/GB.txt_100_4_100__A_I_C.h5","./outputs/GB_MODEL_2/GB.txt_100_4_100__A_I_C_index")
app = Flask(__name__)
@app.route('/')
......@@ -17,4 +17,8 @@ def home():
@app.route('/text')
def text():
return render_template("text.html",title="Text Geocoder")
\ No newline at end of file
return render_template("text.html",title="Text Geocoder")
@app.route('/geocode')
def geocode():
pass
\ No newline at end of file
{% extends 'skeleton.html' %}
{% block content %}
{% extends 'skeleton.html' %} {% block content %}
<!-- MAP RENDER -->
<div id="mapid"></div>
<!-- TOPONYM FORM -->
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laborum, modi natus ab repellendus ex explicabo, sunt fuga commodi porro ipsam deserunt facilis culpa aspernatur odio tenetur quibusdam perferendis ipsum cupiditate?</p>
{% endblock %}
{% block script %}
<div class="container">
<p>
</p>
<form action="">
<div class="form-group">
<label for="exampleFormControlTextarea1">Your text</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
<br>
<button class="btn btn-info" id="submit">Geocode</button>
</div>
</form>
<h5>Results :</h5>
<div class="col-lg-12" style="border:1px solid #666">
<p id="result_container"></p>
</div>
</div>
{% endblock %} {% block script %}
<script>
// Initialize the map
// [50, -0.1] are the latitude and longitude
// 4 is the zoom
......@@ -22,11 +35,7 @@
// Add a tile to the map = a background. Comes from OpenStreetmap
L.tileLayer(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a>',
}).addTo(mymap);
var marker = L.marker([{{lat}}, {{lon}}]).addTo(mymap);
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a>',
}).addTo(mymap);
</script>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment