Esempio n. 1
0
    def _convert(self):
        try:
            if not os.path.exists(self.clips_path):
                os.makedirs(self.clips_path)
            if not os.path.exists(self.video_folder):
                os.makedirs(self.video_folder)

            # Extract Zip to the folder
            unzip(self.zip_path, self.clips_path)
            self._update_status("Unzipped")
            Logger.debug("Unzipped clips for file " + str(self.zip_path))
            Logger.debug("clips are available at  " + str(self.clips_path))

            # move clips to root
            move_to_root_folder(self.clips_path, self.clips_path)
            Logger.debug("Moving clips to root dir is done")
            # Delete Small clips ...

            deleted_clips = delete_small_clips(self.clips_path)
            Logger.debug(
                "Following Clips are deleted due to low size (less than 100kb)"
            )

            for deleted_clip in deleted_clips:
                Logger.debug(deleted_clip)

            self._update_progress_bar(50)
            self._update_status("Ready to make video")
            # merge clips and make video

            Logger.debug("Entered to merging try block")
            merge(self.clips_path, self.video_location, self._update_progress)
            Logger.debug("End of merging try block")

            # Clearing Temp dir
            delete_all_clips(self.clips_path)
            self._update_status(
                os.path.basename(self.video_location)[:-4] +
                " is now ready to watch")
            self._toast("Always use Mx/Vlc Player to watch Videos")

        except Exception:
            Logger.exception('Something happened wrong at merge')
            self._update_status("Something happened wrong at merge")
Esempio n. 2
0
import nltk
import helper

g = helper.merge(["Grammar", "Lexicon"])

grammar = nltk.grammar.CFG.fromstring(g)

files = ["Positive", "Negative", "Overgen", "Undergen"]

print("% Xin Wen, wenxin6, 1000442666")
for name in files:
    print("\n% " + name)
    helper.output(name, grammar)
import plotly.graph_objects as go
from helper import merge

import dash  # (version 1.12.0) pip install dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from urllib.request import urlopen
import json
with urlopen(
        'https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json'
) as response:
    counties = json.load(response)

app = dash.Dash(__name__)
df = merge()

app.layout = html.Div([dcc.Graph(id='my_map', figure={})])

fig = px.choropleth(
    data_frame=df,
    geojson=counties,
    locations='STCOUNTYFP',
    color='Estimated_Percent_Insured',
    scope="usa",
    color_continuous_scale="Viridis",
    labels={'Estimated_Percent_Insured': 'Estimated_Percent_Insured'},
    template='plotly_dark')

fig.show()
Esempio n. 4
0
def test_merge():
    img1 = os.path.join('sample_data', 'sample_lines.png')
    img2 = os.path.join('sample_data', 'cropped.png')
    img3 = os.path.join('sample_data', 'merged.png')
    helper.merge(img2, img1, img3, (150, 150))
    helper.show(img3)