DVampire commited on
Commit
49c88c9
Β·
1 Parent(s): edeb13f
debug_comparison.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Debug script to compare local vs Hugging Face deployment
4
+ """
5
+
6
+ import requests
7
+ import json
8
+ from datetime import date
9
+ import time
10
+
11
+ def test_local_api():
12
+ """Test local API"""
13
+ print("πŸ” Testing LOCAL API...")
14
+ try:
15
+
16
+ # Test daily endpoint
17
+ today = date.today().isoformat()
18
+ daily_response = requests.get(f"http://localhost:7860/api/daily?date_str={today}", timeout=30)
19
+ print(f"Local daily status: {daily_response.status_code}")
20
+
21
+ if daily_response.ok:
22
+ data = daily_response.json()
23
+ cards = data.get('cards', [])
24
+ cards_with_arxiv = [c for c in cards if c.get('arxiv_id')]
25
+ print(f"Local: {len(cards_with_arxiv)}/{len(cards)} cards have arxiv_id")
26
+
27
+ # Show first card details
28
+ if cards:
29
+ first_card = cards[0]
30
+ print(f"Local first card arxiv_id: {first_card.get('arxiv_id', 'MISSING')}")
31
+ print(f"Local first card URL: {first_card.get('huggingface_url', 'N/A')}")
32
+
33
+ except Exception as e:
34
+ print(f"❌ Local API error: {e}")
35
+
36
+ def test_hf_api():
37
+ """Test Hugging Face API"""
38
+ print("\nπŸ” Testing HUGGING FACE API...")
39
+ try:
40
+ base_url = "https://zwt963-paperindex.hf.space"
41
+
42
+
43
+ # Test daily endpoint
44
+ today = date.today().isoformat()
45
+ print(f"HF daily endpoint: {base_url}/api/daily?date_str={today}")
46
+ daily_response = requests.get(f"{base_url}/api/daily?date_str={today}", timeout=30)
47
+ print(f"HF daily status: {daily_response.status_code}")
48
+
49
+ if daily_response.ok:
50
+ data = daily_response.json()
51
+ cards = data.get('cards', [])
52
+ cards_with_arxiv = [c for c in cards if c.get('arxiv_id')]
53
+ print(f"HF: {len(cards_with_arxiv)}/{len(cards)} cards have arxiv_id")
54
+
55
+ # Show first card details
56
+ if cards:
57
+ first_card = cards[0]
58
+ print(f"HF first card arxiv_id: {first_card.get('arxiv_id', 'MISSING')}")
59
+ print(f"HF first card URL: {first_card.get('huggingface_url', 'N/A')}")
60
+
61
+ except Exception as e:
62
+ print(f"❌ HF API error: {e}")
63
+
64
+ def test_direct_hf_access():
65
+ """Test direct access to Hugging Face papers page"""
66
+ print("\nπŸ” Testing DIRECT Hugging Face access...")
67
+ try:
68
+ # Test accessing a specific paper page
69
+ paper_url = "https://huggingface.co/papers/2508.07901"
70
+ response = requests.get(paper_url, timeout=10)
71
+ print(f"Direct HF paper access status: {response.status_code}")
72
+
73
+ if response.ok:
74
+ # Look for arXiv ID in the page
75
+ content = response.text
76
+ if "arxiv:2508.07901" in content:
77
+ print("βœ… Found arxiv:2508.07901 in page content")
78
+ else:
79
+ print("❌ arxiv:2508.07901 not found in page content")
80
+
81
+ # Look for any arXiv references
82
+ if "arxiv.org" in content:
83
+ print("βœ… Found arxiv.org references in page content")
84
+ else:
85
+ print("❌ No arxiv.org references found in page content")
86
+
87
+ except Exception as e:
88
+ print(f"❌ Direct HF access error: {e}")
89
+
90
+ if __name__ == "__main__":
91
+ print("πŸš€ Starting comparison debug...")
92
+
93
+ # Test local API (if running)
94
+ test_local_api()
95
+
96
+ # Test Hugging Face API
97
+ test_hf_api()
98
+
99
+ # Test direct Hugging Face access
100
+ test_direct_hf_access()
101
+
102
+ print("\nπŸ’‘ Possible solutions:")
103
+ print("1. Check if Hugging Face Space is using cached code")
104
+ print("2. Verify network access from Hugging Face to external sites")
105
+ print("3. Check if Hugging Face has different Python/package versions")
106
+ print("4. Try redeploying the Space to clear any caches")
workdir/paper_agent/papers_cache.db DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7c1fc0b499832f97bf8288fee40f5dcf5207b0fea8b5ae970958bcc7b2e109bf
3
- size 3219456