Page 302 - MDP2022-3
P. 302

제  3  장  소프트웨어  설계

            1.  개요

              마이크로  음성인식을  하면  stt를  이용하여  어떤  버스의  정보를  받으려는지  확인한다.
            그  버스의  도착  정보를  open  api를  활용해  화면에  띄우고  몇분  남았는지  tts를  이용하여  도착
            정보를  음성으로  안내한다.  버스기사님에게  승객이  탄다는  것을  알려주기  위해  버스정류장  위에
            있는  led가  켜지도록  한다.

            `
            2.  소프트웨어
            <[Flask]  파이썬  코드>

            app.py

            from  flask  import  Flask
            from  flask  import  request
            from  flask  import  render_template
            from  utils  import  get_bus_stations
            app  =  Flask(__name__)  //flask  객체  생성  ->  라우팅


            @app.route('/')  //@app.route('/경로')  접속  했을  때  return  index.html을  웹브라우저에서  보여준다.
            def  home():
                    return  render_template('index.html')


            @app.route('/1')
            def  signup():
                    return  render_template('1.html')


            @app.route('/2')
            def  signu():
                    return  render_template('2.html')


            @app.route('/3')
            def  sign():
                    return  render_template('3.html')


            @app.route('/w')
            def  sig():
                    return  render_template('w.html')


            @app.route('/shortenurl')
            def  shortenurl():
                    bus_stations  =  get_bus_stations(request.args['id'])
                    return  render_template('shortenurl.html',  stations=bus_stations)

            @app.route('/whereurl')
            def  whereurl():
                    bus_locations  =  get_bus_loc(request.args['id'])
                    return  render_template('whereurl.html',  locations=bus_locations)
            go.py


            import  requests,  xmltodict,  json
            import  pandas  as  pd
            key                                                                                             =
   297   298   299   300   301   302   303   304   305   306   307