update server ports

commented out port is to run on nest server
This commit is contained in:
kaiyuran 2024-11-20 13:03:49 -05:00
parent 8790133b27
commit 6d1377d623
2 changed files with 45 additions and 8 deletions

49
app.py
View file

@ -175,6 +175,39 @@ def emojify(message):
"fruit": "🍉", "fruit": "🍉",
"refreshing": "🍉", "refreshing": "🍉",
"summer": "🍉", "summer": "🍉",
"eggplant": "🍆",
"aubergine": "🍆",
"banana": "🍌",
"peach": "🍑",
"cherries": "🍒",
"strawberry": "🍓",
"tomato": "🍅",
"avocado": "🥑",
"broccoli": "🥦",
"carrot": "🥕",
"corn": "🌽",
"cucumber": "🥒",
"lettuce": "🥬",
"mushroom": "🍄",
"pepper": "🌶️",
"hotpepper": "🌶️",
"potato": "🥔",
"sweetpotato": "🍠",
"croissant": "🥐",
"baguette": "🥖",
"pretzel": "🥨",
"cheese": "🧀",
"egg": "🥚",
"bacon": "🥓",
"pancakes": "🥞",
"poultryleg": "🍗",
"chicken": "🍗",
"meat": "🍖",
"bacon": "🥓",
} }
message = message.strip('"') message = message.strip('"')
@ -201,19 +234,21 @@ def emojify(message):
app = Flask(__name__) app = Flask(__name__)
CORS(app) CORS(app)
#if __name__ == "__main__":
# app.run(host='0.0.0.0', port=33303)
@app.route('/getemoji', methods=['GET']) @app.route('/getemoji', methods=['GET'])
# @cross_origin()
def get_random_emoji(): def get_random_emoji():
# Get the 'letter' parameter from the URL # Get the 'letter' parameter from the URL
message = request.args.get('message') message = request.args.get('message')
print(message) print(message)
final = emojify(message) final = emojify(message)
# print(final) # print(final)
final = jsonify({"message": final})# emoji in JSON format final = jsonify({"message": final})# emoji in JSON format
@ -222,4 +257,6 @@ def get_random_emoji():
return final return final
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) #app.run(debug=True)
app.run(port=33303)
# app.run(host='0.0.0.0', port=33303)

View file

@ -1,7 +1,7 @@
import requests import requests
url = "http://127.0.0.1:5000/getemoji" # url = "http://127.0.0.1:5501/getemoji"
url = "http://37.27.51.34:33303/getemoji"
params = { params = {
"message": "I love chocolate donuts. I laugh at funny jokes about it. I think it is amazing." "message": "I love chocolate donuts. I laugh at funny jokes about it. I think it is amazing."
} }