laxsvips commited on
Commit
f84784f
·
1 Parent(s): 572fe3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -13,13 +13,13 @@ import gradio
13
  # port = os.getenv('PORT')
14
 
15
  # @app.route('/initialize_game', methods=['GET'])
16
- # def initialize_game():
17
- # inputs = request.args.to_dict()
18
- # user_id = inputs['user_id']
19
- # game_id = inputs['game_id']
20
- # result = chat.initialize_game(user_id, game_id)
21
- # response = {'role': 'assistant', 'content': result}
22
- # return jsonify(response)
23
 
24
  # @app.route('/start_game', methods=['GET'])
25
  def play_game(game_id, user_id, user_input):
@@ -44,7 +44,13 @@ def health_check(name):
44
 
45
  health_check_gr = gradio.Interface(
46
  fn=health_check,
47
- inputs=["text","text", "text"]
 
 
 
 
 
 
48
  outputs="text"
49
  )
50
 
@@ -53,7 +59,7 @@ play_game_gr = gradio.Interface(
53
  inputs="text",
54
  outputs="text"
55
  )
56
- demo = gradio.TabbedInterface([health_check_gr, play_game_gr], ["Health Check", "Play Game"])
57
 
58
  demo.launch()
59
 
 
13
  # port = os.getenv('PORT')
14
 
15
  # @app.route('/initialize_game', methods=['GET'])
16
+ def initialize_game(game_id, user_id):
17
+ # inputs = request.args.to_dict()
18
+ # user_id = inputs['user_id']
19
+ # game_id = inputs['game_id']
20
+ result = chat.initialize_game(user_id, game_id)
21
+ response = {'role': 'assistant', 'content': result}
22
+ return response
23
 
24
  # @app.route('/start_game', methods=['GET'])
25
  def play_game(game_id, user_id, user_input):
 
44
 
45
  health_check_gr = gradio.Interface(
46
  fn=health_check,
47
+ inputs=["text","text", "text"],
48
+ outputs="text"
49
+ )
50
+
51
+ initialize_game_gr = gradio.Interface(
52
+ fn=initialize_game,
53
+ inputs=["text","text"],
54
  outputs="text"
55
  )
56
 
 
59
  inputs="text",
60
  outputs="text"
61
  )
62
+ demo = gradio.TabbedInterface([health_check_gr, play_game_gr, initialize_game_gr], ["Health Check", "Play Game", "Initialize game"])
63
 
64
  demo.launch()
65