Bad news. From a Unix command-line perspective those two invocations of your program are identical.
Unix can't easily distinguish them. What you're asking for isn't really sensible, and you need to think of another way of using your program.
In the case where it's not in a pipeline, what's it supposed to read if it doesn't read stdin?
Is it supposed to launch a GUI? If so, you might want to have a "-i" (--interactive) option to indicate you want a GUI, not reading of stdin.
You can, sometimes, distinguish pipes from the console because the console device is "/dev/tty", but this is not portable.