Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,16 +19,15 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 19 |
#test hugging face hub
|
| 20 |
from huggingface_hub import InferenceClient
|
| 21 |
import os
|
| 22 |
-
|
| 23 |
-
client = InferenceClient(model="meta-llama/Llama-2-7b-chat-hf", token=os.getenv("test"))
|
| 24 |
|
| 25 |
try:
|
| 26 |
response = client.text_generation("Hello, how are you?", max_new_tokens=50)
|
| 27 |
print("✅ Model response:", response)
|
| 28 |
except Exception as e:
|
| 29 |
-
import traceback
|
| 30 |
print("❌ Direct call error:", repr(e))
|
| 31 |
-
traceback.print_exc()
|
| 32 |
|
| 33 |
|
| 34 |
class WikipediaSearchTool(Tool):
|
|
@@ -92,6 +91,9 @@ class BasicAgent:
|
|
| 92 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 93 |
return fixed_answer
|
| 94 |
except Exception as e:
|
|
|
|
|
|
|
|
|
|
| 95 |
return f"AGENT ERROR: {e}"
|
| 96 |
|
| 97 |
|
|
|
|
| 19 |
#test hugging face hub
|
| 20 |
from huggingface_hub import InferenceClient
|
| 21 |
import os
|
| 22 |
+
import traceback
|
| 23 |
+
'''client = InferenceClient(model="meta-llama/Llama-2-7b-chat-hf", token=os.getenv("test"))
|
| 24 |
|
| 25 |
try:
|
| 26 |
response = client.text_generation("Hello, how are you?", max_new_tokens=50)
|
| 27 |
print("✅ Model response:", response)
|
| 28 |
except Exception as e:
|
|
|
|
| 29 |
print("❌ Direct call error:", repr(e))
|
| 30 |
+
traceback.print_exc()'''
|
| 31 |
|
| 32 |
|
| 33 |
class WikipediaSearchTool(Tool):
|
|
|
|
| 91 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 92 |
return fixed_answer
|
| 93 |
except Exception as e:
|
| 94 |
+
import traceback
|
| 95 |
+
print("❌ Direct call error:", repr(e))
|
| 96 |
+
traceback.print_exc()
|
| 97 |
return f"AGENT ERROR: {e}"
|
| 98 |
|
| 99 |
|