Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ import os
|
|
| 10 |
import requests
|
| 11 |
import json
|
| 12 |
import re
|
|
|
|
| 13 |
|
| 14 |
# Set page config
|
| 15 |
st.set_page_config(page_title="Neural-Vision Enhanced", layout="wide")
|
|
@@ -65,11 +66,17 @@ def deepseek_chat(user_input, app_mode):
|
|
| 65 |
}
|
| 66 |
headers = {"Authorization": f"Bearer {api_key}"}
|
| 67 |
try:
|
| 68 |
-
response = requests.post(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
response.raise_for_status()
|
| 70 |
return response.json()["choices"][0]["message"]["content"]
|
| 71 |
except requests.exceptions.RequestException as e:
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
# LLM Command Functions
|
| 75 |
def drop_columns(columns):
|
|
|
|
| 10 |
import requests
|
| 11 |
import json
|
| 12 |
import re
|
| 13 |
+
import logging
|
| 14 |
|
| 15 |
# Set page config
|
| 16 |
st.set_page_config(page_title="Neural-Vision Enhanced", layout="wide")
|
|
|
|
| 66 |
}
|
| 67 |
headers = {"Authorization": f"Bearer {api_key}"}
|
| 68 |
try:
|
| 69 |
+
response = requests.post(
|
| 70 |
+
"https://api.deepseek.com/v1/chat/completions",
|
| 71 |
+
json=payload,
|
| 72 |
+
headers=headers,
|
| 73 |
+
timeout=10 # Increased timeout
|
| 74 |
+
)
|
| 75 |
response.raise_for_status()
|
| 76 |
return response.json()["choices"][0]["message"]["content"]
|
| 77 |
except requests.exceptions.RequestException as e:
|
| 78 |
+
st.error(f"Error: Could not connect to DeepSeek API. {str(e)}")
|
| 79 |
+
return "I'm sorry, I couldn't process your request. Please try again later."
|
| 80 |
|
| 81 |
# LLM Command Functions
|
| 82 |
def drop_columns(columns):
|