A MODEL FOR THE X-RAY AND ULTRAVIOLET EMISSION FROM SEYFERT GALAXIES AND GALACTIC BLACK HOLES