Spaces:
Sleeping
Sleeping
Download test.py from vansh-here/TradeSense-backend: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/spaces/vansh-here/TradeSense-backend/resolve/main/test.py
- Command line
-
hf download hf://spaces/vansh-here/TradeSense-backend/test.py
-
curl -L -o test.py https://huggingface.co/spaces/vansh-here/TradeSense-backend/resolve/main/test.py
907 Bytes
| """Quick test for Groq Cloud API connectivity.""" | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| GROQ_API_KEY = os.getenv("GROQ_API_KEY") | |
| if not GROQ_API_KEY or GROQ_API_KEY == "your_groq_api_key_here": | |
| print("ERROR: GROQ_API_KEY is not set in environment.") | |
| print("Get a free key at https://console.groq.com/keys") | |
| else: | |
| try: | |
| import groq_service | |
| print("Testing Groq Parsing...") | |
| result = groq_service.parse_query_with_llm("analyze silver price in Hindi: चांदी की कीमत क्या है?") | |
| print("Groq Parse Result:", result) | |
| print("\nTesting Groq Insight...") | |
| insight = groq_service.generate_insight({"trend": "Bullish", "risk": "Low"}, "analysis") | |
| print("Groq Insight:", insight) | |
| print("\n✅ Groq API working!") | |
| except Exception as e: | |
| print(f"Groq API Error: {e}") |