Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -173,41 +173,38 @@ with gr.Blocks() as demo:
|
|
| 173 |
# outputs=[status_output, results_table]
|
| 174 |
# )
|
| 175 |
|
|
|
|
| 176 |
if __name__ == "__main__":
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
# ]
|
| 189 |
-
# for q in test_questions:
|
| 190 |
-
# print(f"Q: {q}")
|
| 191 |
-
# print(f"A: {agent(q)}")
|
| 192 |
|
| 193 |
-
#
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
| 173 |
# outputs=[status_output, results_table]
|
| 174 |
# )
|
| 175 |
|
| 176 |
+
|
| 177 |
if __name__ == "__main__":
|
| 178 |
+
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
| 179 |
+
|
| 180 |
+
agent = BasicAgent() #sanity check
|
| 181 |
+
test_questions = [
|
| 182 |
+
"What is 2 + 2?",
|
| 183 |
+
"What is the capital of Japan?",
|
| 184 |
+
"Who is the CEO of Tesla?",
|
| 185 |
+
]
|
| 186 |
+
for q in test_questions:
|
| 187 |
+
print(f"Q: {q}")
|
| 188 |
+
print(f"A: {agent(q)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
+
# Check for SPACE_HOST and SPACE_ID at startup for information
|
| 191 |
+
space_host_startup = os.getenv("SPACE_HOST")
|
| 192 |
+
space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
|
| 193 |
+
|
| 194 |
+
if space_host_startup:
|
| 195 |
+
print(f"✅ SPACE_HOST found: {space_host_startup}")
|
| 196 |
+
print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
|
| 197 |
+
else:
|
| 198 |
+
print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
|
| 199 |
+
|
| 200 |
+
if space_id_startup: # Print repo URLs if SPACE_ID is found
|
| 201 |
+
print(f"✅ SPACE_ID found: {space_id_startup}")
|
| 202 |
+
print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
|
| 203 |
+
print(f" Repo Tree URL: https://huggingface.co/spaces/{space_id_startup}/tree/main")
|
| 204 |
+
else:
|
| 205 |
+
print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
|
| 206 |
+
|
| 207 |
+
print("-"*(60 + len(" App Starting ")) + "\n")
|
| 208 |
+
|
| 209 |
+
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 210 |
+
demo.launch(debug=True, share=False)
|