Spaces:
Sleeping
Sleeping
Clean up
Browse files
app.py
CHANGED
@@ -58,11 +58,8 @@ def fetch_active_crypto() -> Optional[Dict[str, Any]]:
|
|
58 |
response.raise_for_status() # Raise an exception for HTTP errors
|
59 |
data = json.loads(response.text)
|
60 |
|
61 |
-
# Extract the top 10 cryptocurrencies by market cap
|
62 |
if 'data' in data:
|
63 |
sorted_crypto = sorted(data['data'], key=lambda x: x['quote']['USD']['market_cap'], reverse=True)
|
64 |
-
# top_10 = sorted_crypto[:10]
|
65 |
-
# return {crypto['name']: crypto['quote']['USD'] for crypto in top_10}
|
66 |
return {crypto['name']: crypto['quote']['USD'] for crypto in sorted_crypto}
|
67 |
else:
|
68 |
print("No data found in the response.")
|
@@ -91,28 +88,18 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
91 |
|
92 |
final_answer = FinalAnswerTool()
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
97 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
98 |
-
|
99 |
-
# model = HfApiModel(
|
100 |
-
# max_tokens=2096,
|
101 |
-
# temperature=0.5,
|
102 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
|
103 |
-
# custom_role_conversions=None,
|
104 |
-
# )
|
105 |
|
106 |
MODEL_IDS = [
|
107 |
-
#'https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud/',
|
108 |
-
#'https://jc26mwg228mkj8dw.us-east-1.aws.endpoints.huggingface.cloud/',
|
109 |
-
# 'https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
110 |
-
#'meta-llama/Llama-3.2-1B-Instruct', ## Does a poor job of interpreting my questions and matching them to the tools
|
111 |
'Qwen/Qwen2.5-Coder-32B-Instruct',
|
112 |
'Qwen/Qwen2.5-Coder-14B-Instruct',
|
113 |
'Qwen/Qwen2.5-Coder-7B-Instruct',
|
114 |
'Qwen/Qwen2.5-Coder-3B-Instruct',
|
115 |
'Qwen/Qwen2.5-Coder-1.5B-Instruct'
|
|
|
|
|
|
|
|
|
116 |
# Add here wherever model is working for you
|
117 |
]
|
118 |
|
@@ -141,7 +128,6 @@ def get_available_model():
|
|
141 |
return MODEL_IDS[0] # if all are failing, use the first model by dfault
|
142 |
|
143 |
if verbose: print("Checking available models.")
|
144 |
-
|
145 |
selected_model_id = get_available_model()
|
146 |
|
147 |
model = HfApiModel(
|
@@ -154,9 +140,8 @@ model = HfApiModel(
|
|
154 |
custom_role_conversions=None,
|
155 |
)
|
156 |
|
157 |
-
############# END: MODEL SELECTION ################################################
|
158 |
-
|
159 |
|
|
|
160 |
|
161 |
# Import tool from Hub
|
162 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
58 |
response.raise_for_status() # Raise an exception for HTTP errors
|
59 |
data = json.loads(response.text)
|
60 |
|
|
|
61 |
if 'data' in data:
|
62 |
sorted_crypto = sorted(data['data'], key=lambda x: x['quote']['USD']['market_cap'], reverse=True)
|
|
|
|
|
63 |
return {crypto['name']: crypto['quote']['USD'] for crypto in sorted_crypto}
|
64 |
else:
|
65 |
print("No data found in the response.")
|
|
|
88 |
|
89 |
final_answer = FinalAnswerTool()
|
90 |
|
91 |
+
########################################## MODEL SELECTION ################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
MODEL_IDS = [
|
|
|
|
|
|
|
|
|
94 |
'Qwen/Qwen2.5-Coder-32B-Instruct',
|
95 |
'Qwen/Qwen2.5-Coder-14B-Instruct',
|
96 |
'Qwen/Qwen2.5-Coder-7B-Instruct',
|
97 |
'Qwen/Qwen2.5-Coder-3B-Instruct',
|
98 |
'Qwen/Qwen2.5-Coder-1.5B-Instruct'
|
99 |
+
#'https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud/',
|
100 |
+
#'https://jc26mwg228mkj8dw.us-east-1.aws.endpoints.huggingface.cloud/',
|
101 |
+
# 'https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
102 |
+
#'meta-llama/Llama-3.2-1B-Instruct', ## Does a poor job of interpreting my questions and matching them to the tools
|
103 |
# Add here wherever model is working for you
|
104 |
]
|
105 |
|
|
|
128 |
return MODEL_IDS[0] # if all are failing, use the first model by dfault
|
129 |
|
130 |
if verbose: print("Checking available models.")
|
|
|
131 |
selected_model_id = get_available_model()
|
132 |
|
133 |
model = HfApiModel(
|
|
|
140 |
custom_role_conversions=None,
|
141 |
)
|
142 |
|
|
|
|
|
143 |
|
144 |
+
################################## AGENT SETUP ################################################
|
145 |
|
146 |
# Import tool from Hub
|
147 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|