Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,10 +26,10 @@ endpoint_uri = load_huggingface_model()
|
|
| 26 |
|
| 27 |
status_info = check_public_endpoint(endpoint_uri)
|
| 28 |
|
| 29 |
-
|
| 30 |
print(status_info["status"])
|
| 31 |
print(status_info["status_code"])
|
| 32 |
-
|
| 33 |
|
| 34 |
if status_info["status"] is False:
|
| 35 |
interface = create_failed_gradio_ui(status_info)
|
|
@@ -41,13 +41,23 @@ else:
|
|
| 41 |
max_tokens=2096,
|
| 42 |
temperature=0.5,
|
| 43 |
model_id= endpoint_uri,
|
| 44 |
-
|
| 45 |
)
|
| 46 |
|
| 47 |
# Load prompts
|
| 48 |
combined_prompts = load_prompts()
|
| 49 |
combined_tools = load_tools() ## from the tools folder (don't remove final answer)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
agent = CodeAgent(
|
| 52 |
model=model,
|
| 53 |
tools=combined_tools,
|
|
|
|
| 26 |
|
| 27 |
status_info = check_public_endpoint(endpoint_uri)
|
| 28 |
|
| 29 |
+
|
| 30 |
print(status_info["status"])
|
| 31 |
print(status_info["status_code"])
|
| 32 |
+
|
| 33 |
|
| 34 |
if status_info["status"] is False:
|
| 35 |
interface = create_failed_gradio_ui(status_info)
|
|
|
|
| 41 |
max_tokens=2096,
|
| 42 |
temperature=0.5,
|
| 43 |
model_id= endpoint_uri,
|
| 44 |
+
custom_role_conversions=None,
|
| 45 |
)
|
| 46 |
|
| 47 |
# Load prompts
|
| 48 |
combined_prompts = load_prompts()
|
| 49 |
combined_tools = load_tools() ## from the tools folder (don't remove final answer)
|
| 50 |
|
| 51 |
+
# Try a direct test of your endpoint
|
| 52 |
+
test_prompt = "Hello, how are you?"
|
| 53 |
+
response = requests.post(
|
| 54 |
+
endpoint_uri,
|
| 55 |
+
json={"inputs": test_prompt},
|
| 56 |
+
headers={"Authorization": f"Bearer {os.getenv('HF_TOKEN')}"}
|
| 57 |
+
)
|
| 58 |
+
print(response.json())
|
| 59 |
+
|
| 60 |
+
|
| 61 |
agent = CodeAgent(
|
| 62 |
model=model,
|
| 63 |
tools=combined_tools,
|