RAHUL-13 commited on
Commit
3ae8479
Β·
verified Β·
1 Parent(s): b57ac7b

Upload inference.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. inference.py +14 -0
inference.py CHANGED
@@ -23,6 +23,20 @@ import json
23
  import time
24
  import requests
25
  from openai import OpenAI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # ─── Configuration ────────────────────────────────────────────────
28
 
 
23
  import time
24
  import requests
25
  from openai import OpenAI
26
+ from pathlib import Path
27
+
28
+ # ─── Load Environment Variables from .env if it exists ───────────
29
+ env_file = Path(__file__).parent / ".env"
30
+ if env_file.exists():
31
+ with open(env_file) as f:
32
+ for line in f:
33
+ line = line.strip()
34
+ if line and not line.startswith("#"):
35
+ key, _, value = line.partition("=")
36
+ key = key.strip()
37
+ value = value.strip()
38
+ if key and value:
39
+ os.environ.setdefault(key, value)
40
 
41
  # ─── Configuration ────────────────────────────────────────────────
42