diff --git a/py/static/index.html b/py/static/index.html index d688702..cef6982 100644 --- a/py/static/index.html +++ b/py/static/index.html @@ -79,11 +79,11 @@ </div> <!-- Input section: Where user input is provided --> - <div class="input"> - <input type="text" placeholder="Type your message here..." /> - <button><img src="/static/img/microphone.svg" alt="microphone"></button> - <button>Send</button> - </div> + <form class="input" method="POST" action=""> + <input type="text" name="name" placeholder="Type your message here..." /> + <button type="submit" name="option" value="voice"><img src="/static/img/microphone.svg" alt="microphone"></button> + <button type="submit" name="option" value="chat">Send</button> + </form> </div> </body> diff --git a/py/web_flask.py b/py/web_flask.py index ce616ed..35223f0 100644 --- a/py/web_flask.py +++ b/py/web_flask.py @@ -1,14 +1,21 @@ -from flask import Flask, send_from_directory +from flask import Flask, request + +APP = Flask(__name__) -class WebHost: - @staticmethod - def main_page(): - app = Flask(__name__) +@APP.route('/', methods=['GET', 'POST']) +def index(): + if request.method == 'POST': + name = request.form['name'] + option = request.form['option'] - @app.route('/') - def index(): - return app.send_static_file('index.html') + if option == "voice": + print(name) + elif option == "chat": + print(name) - if __name__ == '__main__': - app.run(debug=True) + return APP.send_static_file('index.html') + + +if __name__ == '__main__': + APP.run(debug=True) \ No newline at end of file