Yes, you can do a clean install or an upgrade from a flash drive that has at least 4GB of free space. These are the necesary instructions to do so correctly:
Launch the DiskPart utility by typing diskpart at the Start Menu.
Then run the list disk command to check the status of your drive.
Now run select disk 1 where the "1" is actually the corresponding number of your USB drive.
Once the thumb drive is clean, you can run create partition primary.
Now make the partition active by entering active
Then you need to set up the file system as Fat32 by running format fs=fat32 quick (quick, of course, specifies that you want to perform a quick format to speed up the process).
Entering the assign command gives the USB drive a drive letter, making it easy to access from Windows Explorer
Then you can copy everything from the extracted Windows 7 installation DVD onto the USB key (a simple drag and drop will do).
Now you can insert the thumb drive into the system you want to install Windows 7 onto and boot the system. The installation will now proceed as usual—but faster.
Make sure your computer can boot a USB device in the bios for clean install. If you can't this method will still work for upgrade.