Spaces:
Runtime error
Runtime error
Commit
·
75b374d
1
Parent(s):
d7316ba
added AGIEval module
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ def retrieve_api_key(url):
|
|
| 21 |
return api_key
|
| 22 |
|
| 23 |
|
| 24 |
-
def get_benchmark_uids(num_miner):
|
| 25 |
|
| 26 |
url="test.neuralinternet.ai"
|
| 27 |
api_key = retrieve_api_key(url)
|
|
@@ -36,7 +36,7 @@ def get_benchmark_uids(num_miner):
|
|
| 36 |
"Endpoint-Version": "2023-05-19",
|
| 37 |
}
|
| 38 |
|
| 39 |
-
conn.request("GET", f"/top_miner_uids?n={num_miner}", headers=headers)
|
| 40 |
miner_response = conn.getresponse()
|
| 41 |
miner_data = (
|
| 42 |
miner_response.read().decode("utf-8").replace("\n", "").replace("\t", "")
|
|
@@ -85,18 +85,28 @@ def interface_fn(system_prompt, optn, arg, user_prompt):
|
|
| 85 |
|
| 86 |
if optn == 'TOP':
|
| 87 |
|
| 88 |
-
if int(arg) >
|
| 89 |
-
arg =
|
| 90 |
payload['top_n'] = int(arg)
|
| 91 |
payload['messages'] = messages
|
| 92 |
response = retrieve_response(payload)
|
| 93 |
return response
|
| 94 |
|
| 95 |
-
elif optn == '
|
| 96 |
|
| 97 |
-
if int(arg) >
|
| 98 |
-
arg =
|
| 99 |
-
uids = get_benchmark_uids(int(arg))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
payload['uids'] = uids
|
| 101 |
payload['messages'] = messages
|
| 102 |
response = retrieve_response(payload)
|
|
@@ -119,7 +129,7 @@ interface = gr.Interface(
|
|
| 119 |
fn=interface_fn,
|
| 120 |
inputs=[
|
| 121 |
gr.inputs.Textbox(label="System Prompt", optional=True),
|
| 122 |
-
gr.inputs.Dropdown(["TOP", "
|
| 123 |
gr.inputs.Textbox(label="Arguement"),
|
| 124 |
gr.inputs.Textbox(label="Enter your question")
|
| 125 |
],
|
|
@@ -127,7 +137,7 @@ interface = gr.Interface(
|
|
| 127 |
title="Explore Bittensor Miners",
|
| 128 |
description="Enter parameters as per you want and get response",
|
| 129 |
examples=[["Your task is to provide consise response of user prompts", "TOP", 5, 'What is Bittensor?']
|
| 130 |
-
,["Your task is to provide accurate, lengthy response with good lexical flow", "
|
| 131 |
["Act like you're in the technology field for 10+ year and give unbiased opinion", "UIDs", '975,517,906,743,869' , "What are the potential ethical concerns surrounding artificial intelligence and machine learning in healthcare?"]])
|
| 132 |
|
| 133 |
interface.launch(enable_queue=True)
|
|
|
|
| 21 |
return api_key
|
| 22 |
|
| 23 |
|
| 24 |
+
def get_benchmark_uids(num_miner,mode):
|
| 25 |
|
| 26 |
url="test.neuralinternet.ai"
|
| 27 |
api_key = retrieve_api_key(url)
|
|
|
|
| 36 |
"Endpoint-Version": "2023-05-19",
|
| 37 |
}
|
| 38 |
|
| 39 |
+
conn.request("GET", f"/top_miner_uids?n={num_miner}&mode={mode}", headers=headers)
|
| 40 |
miner_response = conn.getresponse()
|
| 41 |
miner_data = (
|
| 42 |
miner_response.read().decode("utf-8").replace("\n", "").replace("\t", "")
|
|
|
|
| 85 |
|
| 86 |
if optn == 'TOP':
|
| 87 |
|
| 88 |
+
if int(arg) > 50:
|
| 89 |
+
arg = 50
|
| 90 |
payload['top_n'] = int(arg)
|
| 91 |
payload['messages'] = messages
|
| 92 |
response = retrieve_response(payload)
|
| 93 |
return response
|
| 94 |
|
| 95 |
+
elif optn == 'BENCHMARK_TextEval':
|
| 96 |
|
| 97 |
+
if int(arg) > 50:
|
| 98 |
+
arg = 50
|
| 99 |
+
uids = get_benchmark_uids(int(arg), 'TextEval')
|
| 100 |
+
payload['uids'] = uids
|
| 101 |
+
payload['messages'] = messages
|
| 102 |
+
response = retrieve_response(payload)
|
| 103 |
+
return response
|
| 104 |
+
|
| 105 |
+
elif optn == 'BENCHMARK_AGIEval':
|
| 106 |
+
|
| 107 |
+
if int(arg) > 50:
|
| 108 |
+
arg = 50
|
| 109 |
+
uids = get_benchmark_uids(int(arg), 'AGIEval')
|
| 110 |
payload['uids'] = uids
|
| 111 |
payload['messages'] = messages
|
| 112 |
response = retrieve_response(payload)
|
|
|
|
| 129 |
fn=interface_fn,
|
| 130 |
inputs=[
|
| 131 |
gr.inputs.Textbox(label="System Prompt", optional=True),
|
| 132 |
+
gr.inputs.Dropdown(["TOP", "BENCHMARK_TextEval", "BENCHMARK_AGIEval", "UIDs"], label="Select Function"),
|
| 133 |
gr.inputs.Textbox(label="Arguement"),
|
| 134 |
gr.inputs.Textbox(label="Enter your question")
|
| 135 |
],
|
|
|
|
| 137 |
title="Explore Bittensor Miners",
|
| 138 |
description="Enter parameters as per you want and get response",
|
| 139 |
examples=[["Your task is to provide consise response of user prompts", "TOP", 5, 'What is Bittensor?']
|
| 140 |
+
,["Your task is to provide accurate, lengthy response with good lexical flow", "BENCHMARK_TextEval", 5, "What is neural network and how its feeding mechanism works?"],
|
| 141 |
["Act like you're in the technology field for 10+ year and give unbiased opinion", "UIDs", '975,517,906,743,869' , "What are the potential ethical concerns surrounding artificial intelligence and machine learning in healthcare?"]])
|
| 142 |
|
| 143 |
interface.launch(enable_queue=True)
|