-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·44 lines (31 loc) · 1.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
import os
from flask import Flask, request, send_file
from model import extend
maxNumOfTokensToExtend = 72
app = Flask(__name__)
@app.route('/favicon.ico')
def favicon():
return send_file('favicon.ico', mimetype='image/vnd.microsoft.icon')
@app.route('/robots.txt')
def robots():
return send_file('robots.txt', mimetype='text/plain')
@app.route('/leket.html')
def leket():
return send_file('HebrewNonsenseFacts_e-gayon.com.html', mimetype='text/html')
@app.route('/checkpoint')
def checkpoint():
return ("20211005-1812")
#return send_file('hebrew-gpt_neo-tiny/counter', mimetype='text/plain')
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return send_file('index.html')
data = request.form.get('text_in')
if len(data) > 0:
title_data = str(data)
else:
title_data = "מחולל הנונסנס הוא"
return extend(title_data,maxNumOfTokensToExtend)
if __name__ == "__main__":
app.run('0.0.0.0', os.environ.get('PORT', 8080))