Spaces:
Runtime error
Runtime error
Download tests/debug_render.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/debug_render.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/debug_render.py
-
curl -L -o debug_render.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/debug_render.py
975 Bytes
| from flask import Flask, render_template | |
| from datetime import datetime | |
| import os | |
| import sys | |
| # Add path | |
| sys.path.append(os.getcwd()) | |
| app = Flask(__name__) | |
| app.secret_key = 'test' | |
| # Mock objects | |
| class MockObj(dict): | |
| def __getattr__(self, name): | |
| return self.get(name) | |
| patient = MockObj({ | |
| "name": "Test Patient", | |
| "sql_id": 1, | |
| "id": 1 | |
| }) | |
| recent_chats = [ | |
| MockObj({ | |
| "sql_id": 101, | |
| "id": 101, | |
| "doctor_name": "Dr. Strange", | |
| "updated_at": datetime.utcnow() | |
| }) | |
| ] | |
| def run_test(): | |
| with app.app_context(): | |
| print("Rendering template...") | |
| try: | |
| html = render_template('patient/patient_dashboard.html', patient=patient, recent_chats=recent_chats) | |
| print("Render Success!") | |
| # print(html[:500]) | |
| except Exception as e: | |
| print("Render FAILED!") | |
| import traceback | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| run_test() | |