Beispiel #1
0
def create_app():
    app = Flask(__name__)

    from .main import main as main_blueprint
    app.register_blueprint(main_blueprint)

    def start_server():
        serve(app, host="127.0.0.1", port=5000)

    ui = FlaskUI(app, maximized=True, server=start_server, host="127.0.0.1", port=5000)

    return ui
Beispiel #2
0
from flask import Flask
from flaskwebgui import FlaskUI

from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.wsgi import WSGIResource

app = Flask(__name__)

from app import routes
from .routes import config, args

resource = WSGIResource(reactor, reactor.getThreadPool(), app)
site = Site(resource)

class dummyRun():
    def __init__(self, reactor):
        self.app = reactor
    def run(self, host = "", port = 5000):
        self.app.listenTCP(port, site)
        self.app.run()



ui = FlaskUI(dummyRun(reactor))
Beispiel #3
0
from flask import *
from flaskwebgui import FlaskUI
app = Flask(__name__)
ui = FlaskUI(
    app,
    app_mode=True,
)


@app.route('/')
def hello_world():
    return render_template("index.html")


@app.route('/sub', methods=['POST', 'GET'])
def nextstep():
    if "page" in request.form:
        return render_template("sex_select.html")
    elif "sex" in request.form:
        return render_template("age_select.html")
    elif "age" in request.form:
        return render_template("select_symptoms.html")
    elif "symptom" in request.form:
        #for demo puproses only
        return render_template(
            "result.html",
            result="covid-19",
            percent="50%",
            defin=
            "Coronavirus disease 2019 (COVID-19) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2).[8] The disease was first identified in December 2019 in Wuhan, the capital of China's Hubei province, and has since spread globally, resulting in the ongoing 2019–20 coronavirus pandemic.[9][10] Common symptoms include fever, cough and shortness of breath.[5] Other symptoms may include fatigue, muscle pain, diarrhoea, sore throat, loss of smell and abdominal pain.[5][11][12] The time from exposure to onset of symptoms is typically around five days, but may range from two to fourteen days.[5][13] While the majority of cases result in mild symptoms, some progress to viral pneumonia and multi-organ failure.[9][14] As of 12 April 2020, more than 1.77 million[7] cases have been reported in over 200 countries and territories,[15] resulting in more than 108,000 deaths.[7] More than 401,000 people have recovered."
        )
Beispiel #4
0
                    finalDict.update(nameDict)
                else:
                    continue
            else:
                continue

        return finalDict

    # PYTHON FROM DATABASE
    ############################################################################################################################


dm = dataMethods()

app = Flask(__name__)
ui = FlaskUI(app, width=1286, height=600)

# MAIN PAGES
############################################################################################################################


@app.route('/')
def startMenu():
    return render_template("startMenu.html")


@app.route('/getName/')
def searchName():
    return render_template("getName.html")

Beispiel #5
0
import json
import os

from flask import Flask, render_template, request, send_file, make_response
from flaskwebgui import FlaskUI

from utils import open_image, read_image, write_docx, read_docx, open_docx, save_docx, convert_text, open_odt, write_odt

app = Flask(__name__)
ui = FlaskUI(app, width=1324, height=728, port=7000)


def normalize(text):
    """Корректирует входной текст"""

    for i in ['.', ',', ':', ';', '!', '?', '(', ')', '-']:
        text = text.replace(' {}'.format(i), i)

    for i in ['.', ',', ':', ';', '!', '?', '(', ')', '-']:
        text = text.replace(i, '{} '.format(i))

    for i in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
        text = text.replace('. {}'.format(i), '.{}'.format(i))

    while '  ' in text:
        text = text.replace('  ', ' ')

    return text


def highighter(old_text, new_text):
import numpy as np
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
import warnings
warnings.filterwarnings('ignore')
from pmdarima.arima import auto_arima
import ctypes
from flaskwebgui import FlaskUI

app = Flask(__name__)
ui = FlaskUI(app, width=1800, height=1000)
app.secret_key = b'8A\x0e\x00=\xab\xb7P9s\x89/'
ALLOWED_EXTENSIONS = {'csv'}


def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS


@app.route('/')
def home():
    return render_template('WebScraping.html')


global Items
Beispiel #7
0
@app.route('/cdn/<path:filename>')
def custom_static(filename):
    return send_from_directory("/" + osp.dirname(filename),
                               osp.basename(filename))


@app.route('/')
def root():
    return redirect(url_for("index"))


@app.route('/index')
def index():
    resp = make_response(render_template("index.html"))
    return resp


@app.route("/show_nodestates")
def show_workers():
    node_list = []
    resp = make_response(
        render_template("show_nodestates.html", worker_list=node_list))
    return resp


uiapp = FlaskUI(app, host="localhost", port=5001)
uiapp.browser_thread = Thread(target=partial(
    open_browser_func, uiapp, localhost='http://127.0.0.1:{}/'.format(5001)))

uiapp.run()
Beispiel #8
0
from flaskwebgui import FlaskUI
from main import app

FlaskUI(app).run()
Beispiel #9
0
from flaskwebgui import FlaskUI
from djangodesktop.wsgi import application as app

ui = FlaskUI(app, start_server='django')

ui.run()
Beispiel #10
0
from flaskwebgui import FlaskUI
from main import app

FlaskUI(app, width=600, height=500).run()
Beispiel #11
0
from flask import Flask
from flask import render_template
from flaskwebgui import FlaskUI

app = Flask(__name__)
ui = FlaskUI(app, width=500, height=500)


@app.route("/")
def hello():
    return render_template('index.html')


@app.route("/home", methods=['GET'])
def home():
    return "Home"


if __name__ == "__main__":
    ui.run()
Beispiel #12
0
from flaskwebgui import FlaskUI
from main import app

FlaskUI(app,
        width=600,
        height=500,
        start_server='flask',
        close_server_on_exit=False).run()
Beispiel #13
0
# Setup the app
static_path = os.path.join(base_dir, 'static')
app = Flask(__name__,
            static_folder=static_path,
            template_folder=os.path.join(base_dir, 'templates'))
app.config['SECRET_KEY'] = 'justasecretkeythatishouldputhere'
if not is_deployed:
    log.info("Disabling caching")
    app.config[
        'SEND_FILE_MAX_AGE_DEFAULT'] = 0  # Stop caching to changes to content files happens right away during debug
    # app.debug = True

# Configure socketIO and the WebUI we use to encapsulate the window
socketio = SocketIO(app)
if args.run_as_app:
    ui = FlaskUI(app, socketio=socketio, host=args.host, port=args.port)
else:
    ui = None

# Make the global thread used to forward data.
thread = None
zmq_port_test = None

temp_dir = tempfile.TemporaryDirectory()


def receive_and_forward(scout):
    """
    Waits for messages sent over the ZMQ link and emits each one via the socketIO link.
    Runs until the thread it runs on is killed.
    """
Beispiel #14
0
import Layout.plotGenerator as pg

relay = 16
io.setwarnings(False)
io.setmode(io.BOARD)
io.setup(relay, io.OUT)
io.output(relay, True)

server = flask.Flask(__name__)

TIMER = True

app = dash.Dash(__name__, server=server)
app.title = 'Sieve Machine'

ui = FlaskUI(server, maximized=True)

app.layout = html.Div(className='app', children=[home])


#START TEST CALLBACK
@app.callback([
    Output('createTest__start', 'style'),
    Output('createTest__stop', 'style'),
    Output('interval__timer', 'disabled'),
    Output('interval__timer', 'max_intervals'),
    Output('interval__timer', 'n_intervals'),
    Output('interval__graph', 'disabled')
], [
    Input('btn__startTest', 'n_clicks'),
    Input('btn__stopTest', 'n_clicks'),
Beispiel #15
0
from flask_mail import Message
from flask_mail import Mail
from flask_apscheduler import APScheduler
import webbrowser
#import CompiledCode as cc
import nextPill
import time
import csv
import numpy as np
from pyshortcuts import make_shortcut

app = Flask(__name__)
app.config['SECRET_KEY'] = '123456'
mail = Mail(app)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
ui = FlaskUI(app, fullscreen=False, maximized=False)


# Set up title, headers, etc for home page
def template(title="pill web app", text="Home Page"):
    now = datetime.now()
    timeString = timeStr.strftime("%-I:%M%p")
    today = now.strftime("%A")
    reminderInfo = ["", "", ""]
    reminderInfo, activateBtn = nextPill.checkNextPillTime(
        timeString, rmdrFreq)
    dateString = now.strftime("%B %-d, %Y")
    '''
    today8am = now.replace(hour=0, minute=0, second=0, microsecond=0)
    if (activateBtn):
        if (now > today8am):
Beispiel #16
0
from flask import Flask
from flask_socketio import SocketIO
from flaskwebgui import FlaskUI

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)


@app.route("/")
def index():
    return {"message": "flask_socketio"}


if __name__ == '__main__':
    # socketio.run(app) for development
    FlaskUI(app, socketio=socketio).run()
Beispiel #17
0
from flaskwebgui import FlaskUI #import FlaskUI class

#You can also call the run function on FlaskUI class instantiation

FlaskUI(server='django').run()
Beispiel #18
0
from flask import Flask, render_template
from flask_socketio import SocketIO
from flaskwebgui import FlaskUI

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)


@app.route("/")
def hello():
    return render_template('index.html')


@app.route("/home", methods=['GET'])
def home():
    return render_template('some_page.html')


if __name__ == '__main__':
    # socketio.run(app) for development
    FlaskUI(app, socketio=socketio, start_server="flask-socketio").run()
Beispiel #19
0
import pokebase as pb

import db
from db import UserNotFound

from config import FlaskConfig, Config

from forms import (LoginForm, RegisterForm)

from pokemons import (get_pokemon_interval)

app = Flask(__name__, template_folder="Templates")
app.config.from_object(FlaskConfig)

ui = FlaskUI(app=app, width=768, height=800)


def login_required(page):
    def wrapper(*args, **kwargs):
        if not 'username' in session:
            return redirect('/')
        return page(*args, **kwargs)

    wrapper.__name__ = page.__name__
    return wrapper


def themeable(page):
    def wrapper(*args, **kwargs):
        if not 'username' in session or not 'theme' in g.user.config:
Beispiel #20
0
from flask import Flask
from flaskwebgui import FlaskUI  # get the FlaskUI class

app = Flask(__name__)

# Feed it the flask app instance
ui = FlaskUI(
    app,
    browser_path=R"C:/Program Files(x86)/Google/Chrome/Application/chrome.exe")


# do your logic as usual in Flask
@app.route("/")
def index():
    return "It works!"


# call the 'run' method
ui.run()
Beispiel #21
0
from flask import Flask, redirect, request, render_template, flash, session
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from werkzeug.utils import secure_filename
import os
from flask_bcrypt import Bcrypt
from flaskwebgui import FlaskUI

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///mine.db'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
app.secret_key = "334455"

ui = FlaskUI(app)  # Remak for FlaxkUi

UPLOAD_FOLDER = "./static/imgs"
ALLOWED_EXTENSION = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER


class Category(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(200), nullable=False)
    created_at = db.Column(db.DateTime, default=datetime.utcnow())


class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(200), nullable=False)
    image = db.Column(db.String(200), nullable=False)
Beispiel #22
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run.py

from flaskwebgui import FlaskUI
from app import app, socketio


def run_sock():
    # TODO Remover IP e Port daqui e colocar em um aqruivo de configuração.
    socketio.run(app, host="127.0.0.1", port=9998)


if __name__ == '__main__':
    ui = FlaskUI(server=run_sock, host="127.0.0.1", port=9998)
    ui.run()
    exit(0)
Beispiel #23
0
    return render_template("controls.html")


@app.route("/space-bar")
def space_bar():
    robo.press("space")
    return render_template("controls.html")


@app.route("/move-cursor/<direction>")
def move_cursor(direction):
    x, y = pag.position()
    if direction == "N":
        robo.hover(x=x, y=y - 20)
    if direction == "S":
        robo.hover(x=x, y=y + 20)
    if direction == "W":
        robo.hover(x=x - 20, y=y)
    if direction == "E":
        robo.hover(x=x + 20, y=y)

    return jsonify({"status": 200})


if __name__ == "__main__":
    #app.run(debug=True, threaded=True)
    def serve_flask():
        serve(app, host='0.0.0.0', port=5000)

    FlaskUI(server=serve_flask, width=400, height=230, host="0.0.0.0").run()
Beispiel #24
0
from flaskwebgui import FlaskUI
from main import app

FlaskUI(app, width=600, height=500, start_server='flask').run()
Beispiel #25
0
import logging


import pandas as pd
import numpy as np
import json

# Set this variable to "threading", "eventlet" or "gevent" to test the
# different async modes, or leave it set to None for the application to choose
# the best option based on installed packages.
async_mode = None

# Flask App Init
app = Flask(__name__)
app.config['SECRET_KEY'] = 'you-will-never-guess'
ui = FlaskUI(app)
ui.height = 900
ui.width = 1200

# Websockets to have seamless communication to the webpage
socketio = SocketIO(app, async_mode=async_mode)

# Create a plotly dashboard using flask
#plotly_dash = Dashboard()
#app = plotly_dash.create_dashboard(app)

thread = None
thread_lock = Lock()

# Socket IO 
count = 0
Beispiel #26
0
from flaskwebgui import FlaskUI  #import FlaskUI class

#You can also call the run function on FlaskUI class instantiation

FlaskUI(server='django', port=8989, width=1920, height=1080).run()
Beispiel #27
0
try:
    nltk.data.find('tokenizers/punkt')

except LookupError:
    print('punkt')
    nltk.download('punkt')

try:
    nltk.data.find('corpora/wordnet')
except LookupError:
    nltk.download('wordnet')
print("Imports Done")
from flaskwebgui import FlaskUI  #get the FlaskUI class

app = Flask(__name__)
ui = FlaskUI(app)


@app.route('/')
def uploads_file():
    return render_template('Transcribo.html')


def conversionop(a):
    audioclip = AudioFileClip(a)
    audioclip.write_audiofile("file.wav")


def recognizing_text():
    from progress.bar import Bar
    with contextlib.closing(wave.open("file.wav", 'r')) as f:
Beispiel #28
0
from fastapi.templating import Jinja2Templates
from fastapi import FastAPI
from flaskwebgui import FlaskUI

app = FastAPI()

# Mounting default static files
app.mount("/dist", StaticFiles(directory="dist/"), name="dist")
app.mount("/css", StaticFiles(directory="dist/css"), name="css")
app.mount("/img", StaticFiles(directory="dist/img"), name="img")
app.mount("/js", StaticFiles(directory="dist/js"), name="js")
templates = Jinja2Templates(directory="dist")


@app.get("/", response_class=HTMLResponse)
async def root(request: Request):
    return templates.TemplateResponse("index.html", {"request": request})


@app.get("/home", response_class=HTMLResponse)
async def home(request: Request):
    return templates.TemplateResponse("some_page.html", {"request": request})


if __name__ == "__main__":

    def saybye():
        print("on_exit bye")

    FlaskUI(app, start_server='fastapi', on_exit=saybye).run()
Beispiel #29
0
from flask import Flask,render_template,flash,redirect
from flaskwebgui import FlaskUI 
from form_parts import item,LoginForm

app = Flask(__name__)
app.config['SECRET_KEY'] = 'make this a secret later lol'
#ui = FlaskUI(app)


ui = FlaskUI(app)

#where the user lands if logged in successfully
@app.route('/index', methods=['GET', 'POST'])
def index():
    return render_template('base.html')

#Login for the user
@app.route('/', methods=['GET', 'POST'])
def login():
    form = LoginForm()
    if form.validate_on_submit():
        # Get the shop name from the DB based on the username and pass
        return render_template('base.html',data={"shop_name":"Shop name from DB here"})
    return render_template('login.html', title='Sign In', form=form)

#Form for the user to add a new item
@app.route('/new_item',methods=['GET', 'POST'])
def add_item():
    form = item()
    if form.validate_on_submit():
        datas=[form.name.data,form.description.data,form.price.data]
Beispiel #30
0
import os, sys, shutil
import re
import requests
import random
import json
from flask import Flask, redirect, render_template, request, url_for, send_from_directory
#from webui import WebUI
from flaskwebgui import FlaskUI
from uuid import uuid4
sys.path.append("scripts")

app = Flask(__name__)
#ui = WebUI(app)
ui = FlaskUI(app, port=5240, maximized=True)
#sys.path.append(os.path.join(app.root_path, "scripts") if isinstance(app.root_path, str) else "scripts")
#import objects
#import functions
from scripts import objects
from scripts import functions

objects.root_path = app.root_path
tronco_config = objects.TroncoConfig()
session_tokens = objects.SessionTokens()
tronco_tokens = objects.TroncoTokens()
temporary_objects = objects.TemporaryObjects()
advanced_corpora = objects.AdvancedCorpora()
corpora_history = objects.CorporaHistory()
app.jinja_env.globals.update(tronco_config=tronco_config)


@app.route("/api/sort", methods=["POST"])