gpcerv commited on
Commit
719d8e1
1 Parent(s): b7da52a

Upload 9 files

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ hub_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask
2
+ from flask import request
3
+ from flask import render_template
4
+ from flask import redirect
5
+ from flask import jsonify
6
+ from flask import send_from_directory
7
+ import json
8
+ import numpy as np
9
+ import moduli
10
+ from hugchat import hugchat
11
+ from numpy.linalg import norm
12
+ import datetime
13
+ import tensorflow as tf
14
+ import tensorflow_hub as hub
15
+ import tensorflow_text
16
+
17
+ model_url = "./hub_model/"
18
+ hub_layer = hub.load(model_url)
19
+ path='./'
20
+ app = Flask(__name__, template_folder=path+'/templates',static_url_path='',static_folder=path+'/static')
21
+
22
+ def support_jsonp(func):
23
+ """Wraps JSONified output for JSONP requests."""
24
+ @wraps(func)
25
+ def decorated_function(*args, **kwargs):
26
+ callback = request.args.get('callback', False)
27
+ if callback:
28
+ resp = func(*args, **kwargs)
29
+ resp.set_data('{}({})'.format(
30
+ str(callback),
31
+ resp.get_data(as_text=True)
32
+ ))
33
+ resp.mimetype = 'application/javascript'
34
+ return resp
35
+ else:
36
+ return func(*args, **kwargs)
37
+ return decorated_function
38
+
39
+ @app.route("/")
40
+ def flask_app():
41
+ return '<br>' \
42
+ '<h3><a href="https://www.aubaypoc.altervista.org/la7_demo.php" target="_blank">Vai alla 7Demo!</a></h3>' \
43
+ '<br>' \
44
+ '<h3><a href="https://www.ftintelligence.altervista.org/qa.php" target="_blank">Vai alla Question Answering Demo!</a></h3>'
45
+
46
+ @app.route('/broadcast_labels',methods=['POST','GET'])
47
+ def broadcast_labels():
48
+ if request.method == 'GET':
49
+ s=request.args.get('S')
50
+ dati=moduli.la7_labels(s)
51
+ output=dati
52
+ response = jsonify(output)
53
+ return response
54
+
55
+ @app.route('/requestsQA',methods=['POST','GET'])
56
+ def tasksQA():
57
+ ris=''
58
+ if request.method == 'POST':
59
+ domanda = str(request.form['domanda']).strip()
60
+ s = str(request.form['S']).strip()
61
+ ris=moduli.la7_QA(s,domanda,nlp_p)
62
+ return ris
63
+
64
+ @app.route('/requestsSearch',methods=['POST','GET'])
65
+ def tasksSearch():
66
+ response=''
67
+ if request.method == 'POST':
68
+ domanda = str(request.form['frase']).strip()
69
+ s = str(request.form['S']).strip()
70
+ dati=moduli.la7_Search(s,domanda,hub_layer)
71
+ output=dati
72
+ response = jsonify(output)
73
+ return response
74
+
75
+ @app.route('/predict', methods=['POST','GET'])
76
+ def predict():
77
+ dati=[]
78
+ #context=request.args.get('testo')
79
+ context=str(request.form['testo']).strip()
80
+ #question=request.args.get('testo_domanda')
81
+ question=str(request.form['testo_domanda']).strip()
82
+ w=moduli.la7_Bot(context,question,hugchat)
83
+ d={}
84
+ d['risultato']=w
85
+ d['nome']='ok'
86
+ data=jsonify(d)
87
+ data.headers.add('Access-Control-Allow-Origin', '*')
88
+ return data
89
+
90
+
91
+ if __name__ == "__main__":
92
+ #app.run(host="0.0.0.0")
93
+ #app.run(debug=False)
94
+ app.run()
cookies.json ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "domain": ".huggingface.co",
4
+ "expirationDate": 1716383545,
5
+ "hostOnly": false,
6
+ "httpOnly": false,
7
+ "name": "__stripe_mid",
8
+ "path": "/",
9
+ "sameSite": "strict",
10
+ "secure": true,
11
+ "session": false,
12
+ "storeId": null,
13
+ "value": "b33726b4-9262-430e-9269-49173b842270e2b841"
14
+ },
15
+ {
16
+ "domain": ".huggingface.co",
17
+ "expirationDate": 1719407767.751054,
18
+ "hostOnly": false,
19
+ "httpOnly": false,
20
+ "name": "_ga",
21
+ "path": "/",
22
+ "sameSite": null,
23
+ "secure": false,
24
+ "session": false,
25
+ "storeId": null,
26
+ "value": "GA1.2.1073053110.1681987579"
27
+ },
28
+ {
29
+ "domain": ".huggingface.co",
30
+ "expirationDate": 1713523934.53824,
31
+ "hostOnly": false,
32
+ "httpOnly": true,
33
+ "name": "token",
34
+ "path": "/",
35
+ "sameSite": "lax",
36
+ "secure": true,
37
+ "session": false,
38
+ "storeId": null,
39
+ "value": "EyuZYTjUSrTonRhGoMVFTlJQbPrqrTyBTkyElCsKeusiJeISYLAnTsQSIIGDmGaQQNXVtkDuWONXdmPxcKmqxzetHgGgaYlHzqDzdKIbdmAOuAtlbtatbBNJGchblEsn"
40
+ },
41
+ {
42
+ "domain": ".huggingface.co",
43
+ "expirationDate": 1706086451,
44
+ "hostOnly": false,
45
+ "httpOnly": false,
46
+ "name": "intercom-device-id-hgve3glw",
47
+ "path": "/",
48
+ "sameSite": "lax",
49
+ "secure": false,
50
+ "session": false,
51
+ "storeId": null,
52
+ "value": "1453b08c-cdf1-4307-8505-0e82a4c70ce3"
53
+ },
54
+ {
55
+ "domain": ".huggingface.co",
56
+ "expirationDate": 1684849345,
57
+ "hostOnly": false,
58
+ "httpOnly": false,
59
+ "name": "__stripe_sid",
60
+ "path": "/",
61
+ "sameSite": "strict",
62
+ "secure": true,
63
+ "session": false,
64
+ "storeId": null,
65
+ "value": "804b5b92-8311-496d-86a4-afdbec5883bfbc43a6"
66
+ },
67
+ {
68
+ "domain": ".huggingface.co",
69
+ "expirationDate": 1719407767.741976,
70
+ "hostOnly": false,
71
+ "httpOnly": false,
72
+ "name": "_ga_8Q63TH4CSL",
73
+ "path": "/",
74
+ "sameSite": null,
75
+ "secure": false,
76
+ "session": false,
77
+ "storeId": null,
78
+ "value": "GS1.1.1684846713.41.1.1684847767.0.0.0"
79
+ },
80
+ {
81
+ "domain": ".huggingface.co",
82
+ "expirationDate": 1684934167,
83
+ "hostOnly": false,
84
+ "httpOnly": false,
85
+ "name": "_gid",
86
+ "path": "/",
87
+ "sameSite": null,
88
+ "secure": false,
89
+ "session": false,
90
+ "storeId": null,
91
+ "value": "GA1.2.248779127.1684846713"
92
+ },
93
+ {
94
+ "domain": "huggingface.co",
95
+ "expirationDate": 1716470167.628733,
96
+ "hostOnly": true,
97
+ "httpOnly": true,
98
+ "name": "hf-chat",
99
+ "path": "/",
100
+ "sameSite": "no_restriction",
101
+ "secure": true,
102
+ "session": false,
103
+ "storeId": null,
104
+ "value": "3f4fb6bf-5291-47c3-980a-1512cb244a9d"
105
+ },
106
+ {
107
+ "domain": ".huggingface.co",
108
+ "expirationDate": 1706086451,
109
+ "hostOnly": false,
110
+ "httpOnly": false,
111
+ "name": "intercom-id-hgve3glw",
112
+ "path": "/",
113
+ "sameSite": "lax",
114
+ "secure": false,
115
+ "session": false,
116
+ "storeId": null,
117
+ "value": "6e2010b7-4642-4e5d-9ebc-094c0272d0a3"
118
+ }
119
+ ]
hub_model/saved_model.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aea05ab4f38b378ed33359e7ae9b759b388c27a7267e26ee1fabf1f12a15caaf
3
+ size 9339616
hub_model/variables/variables.data-00000-of-00001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6dcbc87e48438f803b0237fbb0941e8dec12f1c28ef5fc738ed7ba0a9a1ec182
3
+ size 341194862
hub_model/variables/variables.index ADDED
Binary file (27.2 kB). View file
 
moduli.so ADDED
Binary file (807 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ flask
2
+ numpy
3
+ tensorflow
4
+ tensorflow_text
5
+ hugchat