semvec/pypi-packages huggingface dataset:
pitwi 0.5.2
User interface for terminal.
Requires Python: >=3, <4
Keywords: terminal tui gui console user interface

# Pitwi

[![PyPI](https://img.shields.io/pypi/v/pitwi)](https://pypi.org/project/pitwi/)
[![GitHub issues](https://img.shields.io/github/issues/4surix/pitwi)](https://github.com/4surix/pitwi/issues)
[![Download](https://img.shields.io/pypi/dm/pitwi)](https://pypi.org/project/pitwi/)
![Version python](https://img.shields.io/pypi/pyversions/pitwi)

Librairy for create user interface in terminal/console with XML, CSS and Python.

# Aperçu

## Only Python :

```python
from pitwi import Root, Text

(
    Root(width = 45, height = 8)
    .add(Text('Puf', bg='white', fg='black'))
    .add(Text('Paf'), row=2, column=2)
    .run()
)
```

## Python + XML/CSS :

```xml
<root width="45" height="8">
    <style>
        #pwik {
            bg: white;
            fg: black;
        }
    </style>
    <text id="pwik">Puf</text>
    <text row="2" column="2">Paf</text>
</root>
```

```python
from pitwi import parser

parser.file('NAME_OF_YOUR_FILE.xml').run()
```

## Weather

![weather](https://cdn.discordapp.com/attachments/557310650569850881/817915701620506694/syyhLr5L76.gif)

> [weather.xml](https://github.com/4surix/pitwi/blob/main/exemples/weather.xml)

## File explorer

![file_explorer](https://cdn.discordapp.com/attachments/557310650569850881/817915760570793994/phVuxs5gRt.gif)

> [file_explorer.xml](https://github.com/4surix/pitwi/blob/main/exemples/file_explorer.xml)

## Expression

![expression](https://cdn.discordapp.com/attachments/557310650569850881/899586259016622120/1D8NQnNvoe.gif)

> [calcul.xml](https://github.com/4surix/pitwi/blob/main/exemples/calcul.xml)

## Ramass'herbe

![ramassherbe](https://cdn.discordapp.com/attachments/557310650569850881/899586377082105876/Y6hB1XZP5J.gif)

> [rammassherbe.xml](https://github.com/4surix/pitwi/blob/main/exemples/ramassherbe.xml)

# Documentation

## Text :

The text is between an opening and closing tag. `<tag>text</tag>`  
  
The space in the beginning and the end are ignored.  
  
`<tag>   pantoufle  </tag>` == `<tag>pantoufle</tag>`  
  
The character `{` and `}` is used to use Python code online. Is same as f-string.  
  
`<tag>{f"Pomme {{poire}} fraise"}</tag>` == `<tag>Pomme {poire} fraise</tag>`  
  
The characters `<`, `>` is depreciated because XML not supported in text. Use escape character to use it. `<tag>Puik \<puf\> paf</tag>`  

## Selection :

Press `Tab` to select next element and `Ctrl+Tab` to select previous element.  
  
## Colors :

```xml
<root>
    <style>
        object {
            item: color;
        }
    </style>
</root>
```

```xml
<root>
    <style>
        .exemple {
            color: white;
            fg: blue;
            bg: red;
            border-color: yellow;
            active-border-color: cyan;
        }
    </style>
</root>
```

### Dark

- black
- red
- green
- yellow
- blue
- magenta
- cyan
- silver

### Light

- gray
- pink
- lime
- banana
- marlin
- violet
- teal
- white
spec-augment 0.0.3
Tensorflow Layer that implements the SpecAugment technique
Requires Python: >=3.5

# Theory

This library contains an implementation of [SpecAugment](https://arxiv.org/abs/1904.08779), a simple data 
augmentation technique for speech recognition. Following the [kapre](https://github.com/keunwoochoi/kapre) philosophy,
the implementation of this method has been encapsulated in a custom layer of 
Tensorflow, so that it can be incorporated into our neural network architectures directly.

# Install Package

To install the package execute the following command.

```
pip install spec-augment
```

# Usage

```
SpecAugment(freq_mask_param=5, time_mask_param=10)

SpecAugment(freq_mask_param=5, time_mask_param=10, n_freq_mask=5, n_time_mask=3)

SpecAugment(freq_mask_param=5, time_mask_param=10, n_freq_mask=5, n_time_mask=3,
            mask_value=0)
```

# Arguments

- **freq_mask_param** - Frequency Mask Parameter (F in the paper)
- **time_mask_param** - Time Mask Parameter (T in the paper)
- **n_freq_mask** - Number of frequency masks to apply (mF in the paper). By default is 1.
- **n_time_mask** - Number of time masks to apply (mT in the paper). By default is 1.
- **mask_value** - Imputation value. By default is zero.

# Example

SpecAugment is a technique applicable to spectrograms. In the following example, kapre is used to compute
the Mel Spectrogram of a sample audio from Librosa.

```
import tensorflow as tf
from tensorflow.keras.models import Sequential
import librosa
import kapre
from spec_augment import SpecAugment

filename = librosa.ex('trumpet')
y, sr = librosa.load(filename)

audio_tensor = tf.reshape(tf.cast(y, tf.float32), (1, -1, 1))
input_shape = y.reshape(-1, 1).shape

melgram = kapre.composed.get_melspectrogram_layer(input_shape=input_shape,
                                                  n_fft=1024,
                                                  return_decibel=True,
                                                  n_mels=256,
                                                  input_data_format='channels_last',
                                                  output_data_format='channels_last')
```

Now we instantiate the SpecAugment layer. We are using an F of 5 (freq_mask_param), a T of 10 (time_mask_param), 
5 frequency masks (n_freq_mask) and 3 time masks (n_time_mask). We will use a mask_value of -100.

```

# Now we define the SpecAugment layer
spec_augment = SpecAugment(freq_mask_param=5,
                           time_mask_param=10,
                           n_freq_mask=5,
                           n_time_mask=3,
                           mask_value=-100)                 
model = Sequential()
model.add(melgram)
model.add(spec_augment)

model.summary()
```

# References

https://arxiv.org/abs/1904.08779