Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -37,8 +37,22 @@ def write_elo_ratings(elo_ratings):
|
|
37 |
json.dump(elo_ratings, file, indent=4)
|
38 |
|
39 |
def get_bot_response(url, prompt):
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
def chat_with_bots(user_input):
|
43 |
bot_names = list(chatbots.keys())
|
44 |
random.shuffle(bot_names)
|
|
|
37 |
json.dump(elo_ratings, file, indent=4)
|
38 |
|
39 |
def get_bot_response(url, prompt):
|
40 |
+
payload = {
|
41 |
+
"input": {
|
42 |
+
"prompt": prompt,
|
43 |
+
"sampling_params": {
|
44 |
+
"max_new_tokens": 16,
|
45 |
+
"temperature": 0.7,
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
headers = {
|
50 |
+
"accept": "application/json",
|
51 |
+
"content-type": "application/json",
|
52 |
+
"authorization": os.environ.get("RUNPOD_TOKEN")
|
53 |
+
}
|
54 |
+
response = requests.post(url, json=payload, headers=headers)
|
55 |
+
return response.json()
|
56 |
def chat_with_bots(user_input):
|
57 |
bot_names = list(chatbots.keys())
|
58 |
random.shuffle(bot_names)
|