nanoppa commited on
Commit
7e4060c
·
verified ·
1 Parent(s): c7fad4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -30,8 +30,21 @@ def get_models():
30
  'https://chat.akash.network/api/models',
31
  headers=headers
32
  )
33
- print(response.text)
34
- return response.json()
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
  @app.route('/v1/chat/completions', methods=['POST'])
 
30
  'https://chat.akash.network/api/models',
31
  headers=headers
32
  )
33
+ models_data = response.json()
34
+ current_timestamp = int(time.time())
35
+ converted_data = {
36
+ "object": "list",
37
+ "data": [
38
+ {
39
+ "id": model["id"],
40
+ "object": "model",
41
+ "created": current_timestamp,
42
+ "owned_by": model["name"].lower().replace(" ", "_")
43
+ }
44
+ for model in models_data["models"]
45
+ ]
46
+ }
47
+ return converted_data
48
 
49
 
50
  @app.route('/v1/chat/completions', methods=['POST'])