Gifu. You will be immersed in the language and will have many opportunities to speak Japanese. In Tokyo or Kobe, there are many foreign residents and foreign tourists, so the necessity of speaking Japanese is somewhat diminished. Gifu will cause you to focus on language, and you will not be too distracted like you would be in Tokyo or Kobe. I don't know about Ueda, are you talking about the Ueda in Nagano?
In my case, I don't know many foreigners in Tokyo (I can count on one hand) but I've met quite a few Japanese friends who speak enough English that I can switch back and forth without being forced to power through the difficult Japanese conversations. So yeah, further out with only native speakers is better for learning!
Although lately, said friends have been threatening to charge me 100 yen for every time I use English...
That's true. I lived in Tokyo but I deliberately avoided dating girls who could speak English. And now I'm still forced to speak Japanese daily. I guess I didn't think my strategy through to its logical conclusion.
It doesn't matter which city you should go. I've been a research student in University of Tokyo for almost two months, and I'm the only foreigner in my lab. My sensei asked everybody around me for speaking only in Japanese to me. She even asked me to join seminars, workshops and classes in full Japanese. It was really stressful in the beginning, but now, I'm starting to enjoy it.