0Learn commited on
Commit
a35390a
·
verified ·
1 Parent(s): c54abcf

Update frontend.py

Browse files
Files changed (1) hide show
  1. frontend.py +2 -3
frontend.py CHANGED
@@ -6,9 +6,8 @@ history = []
6
 
7
  def calculate(expression):
8
  try:
9
- # Dynamically construct the API URL
10
- base_url = gr.utils.get_space_url() or "http://localhost:7860"
11
- api_url = f"{base_url}/calculate"
12
 
13
  response = requests.post(api_url, json={"expr": expression})
14
  if response.status_code == 200:
 
6
 
7
  def calculate(expression):
8
  try:
9
+ # Use relative URL, which works both locally and on Hugging Face Spaces
10
+ api_url = "/calculate"
 
11
 
12
  response = requests.post(api_url, json={"expr": expression})
13
  if response.status_code == 200: