def plot_active_cases(country): data.process_data(country) model = Model(data.dtf) model.forecast() model.add_deaths(data.mortality) result = Result(model.dtf) return result.plot_active(model.today)
def render_output_panel(country): data.process_data(country) model = Model(data.dtf) model.forecast() model.add_deaths(data.mortality) result = Result(model.dtf) peak_day, num_max, total_cases_until_today, total_cases_in_30days, active_cases_today, active_cases_in_30days = result.get_panel( ) peak_color = "white" if model.today > peak_day else "red" panel = html.Div([ html.H4(country), dbc.Card(body=True, className="text-white bg-primary", children=[ html.H6("Total cases until today:", style={"color": "white"}), html.H3("{:,.0f}".format(total_cases_until_today), style={"color": "white"}), html.H6("Total cases in 30 days:", className="text-danger"), html.H3("{:,.0f}".format(total_cases_in_30days), className="text-danger"), html.H6("Active cases today:", style={"color": "white"}), html.H3("{:,.0f}".format(active_cases_today), style={"color": "white"}), html.H6("Active cases in 30 days:", className="text-danger"), html.H3("{:,.0f}".format(active_cases_in_30days), className="text-danger"), html.H6("Peak day:", style={"color": peak_color}), html.H3(peak_day.strftime("%Y-%m-%d"), style={"color": peak_color}), html.H6("with {:,.0f} cases".format(num_max), style={"color": peak_color}) ]) ]) return panel
import argparse from python.model import Model if __name__ == "__main__": parser = argparse.ArgumentParser() # required parser.add_argument("caffemodel", help="") parser.add_argument("deploy", help="") # optional parser.add_argument("-m", "--mean", help="") parser.add_argument("-l", "--labels", help="") parser.add_argument("-g", "--gpu", dest="gpu", action="store_true", help="") parser.set_defaults(gpu=False) args = vars(parser.parse_args()) model = Model(caffemodel_file=args["caffemodel"], deploy_file=args["deploy"], mean_file=args["mean"], labels_file=args["labels"], gpu=args["gpu"]) print model.classify(image_path="")
parser = argparse.ArgumentParser() # required parser.add_argument("caffemodel", help="") parser.add_argument("deploy", help="") # optional parser.add_argument("--port", type=int, help="") parser.add_argument("--mean", help="") parser.add_argument("--labels", help="") parser.add_argument("--gpu", dest="gpu", action="store_true", help="") parser.add_argument("--download_folder", help="") parser.set_defaults(port=8080) parser.set_defaults(gpu=False) parser.set_defaults(download_folder="/tmp/caffe-classifier") args = vars(parser.parse_args()) download_folder = args["download_folder"] make_download_folder() model = Model(caffemodel_file=args["caffemodel"], deploy_file=args["deploy"], mean_file=args["mean"], labels_file=args["labels"], gpu=args["gpu"]) start(args["port"])