Transport map UI along almost vertical road

can some method be developed to avoid those route numbers go on both ways?

Where are you seeing this map?
Standard OSM map does not shows those references ( https://www.openstreetmap.org/#map=17/22.30952/114.16027 ).
Unless the map isn’t made by you you should try to discuss the subject with the map provider, assuming it’s a raster map witch do not allow you to alter the map easily.

Look here:

https://wiki.openstreetmap.org/wiki/Transport_Map

About the only other option is to have the label orientation relative to the direction of the way/route, but then you’d end up with upside-down labels, which IMO would be even worse.

Can some special handling be added, for instance if the highway relationship consists of over 80% way that are +/-15 degree from the N/S axis within the display area then use the direction of >50% length to display the numbers?