Two-dimensional (2D) nanomaterials, especially the transition metal sulfide semiconductors, have drawn great interests due to their potential applications in viable photonic and optoelectronic devices, such as saturable absorbers (SAs) and optical switches, etc. In this work, tungsten disulfide (WS2) based SA for ultrafast photonic applications was demonstrated. WS2 nanosheets were prepared using liquid-phase exfoliation method and embedded in polyvinyl alcohol (PVA) thin film for the practical usage. Saturable absorption was observed in the WS2-PVA SA at the telecommunication waveband near 1550 nm. By incorporating WS2-PVA SA into a fiber laser cavity, both stable mode locking operation and Q-switching operation were achieved. In the mode locking operation, the laser obtained femtosecond output pulse width and high spectral purity in the radio frequency spectrum. In the Q-switching operation, the laser had tunable repetition rate and output pulse energy of a few tens of nano joule. Our findings suggest that few-layer WS2 nanosheets embedded in PVA thin film are promising nonlinear optical materials for ultrafast photonic applications as a mode locker or Q-switcher.