Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ from langgraph.graph import START, StateGraph
|
|
| 16 |
from langgraph.graph.message import add_messages
|
| 17 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 18 |
from langchain_mistralai import ChatMistralAI
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
import getpass
|
|
@@ -52,13 +53,16 @@ def get_ref_content(path: str) -> str | object:
|
|
| 52 |
"""Retrieves content from the reference path provided."""
|
| 53 |
if path.endswith('mp3') or path.startswith('https://www.youtube.com/'):
|
| 54 |
file = librosa.load(path)
|
|
|
|
|
|
|
|
|
|
| 55 |
elif path.endswith('.xlsx') or path.endswith('.xls'):
|
| 56 |
-
file = pd.read_excel(path).
|
| 57 |
elif path.startswith('http'):
|
| 58 |
-
file = requests.get(path).
|
| 59 |
else:
|
| 60 |
with open(path, "rb") as f:
|
| 61 |
-
file = f.
|
| 62 |
return file
|
| 63 |
|
| 64 |
def search_web(query: str) -> str:
|
|
|
|
| 16 |
from langgraph.graph.message import add_messages
|
| 17 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 18 |
from langchain_mistralai import ChatMistralAI
|
| 19 |
+
import cv2
|
| 20 |
|
| 21 |
|
| 22 |
import getpass
|
|
|
|
| 53 |
"""Retrieves content from the reference path provided."""
|
| 54 |
if path.endswith('mp3') or path.startswith('https://www.youtube.com/'):
|
| 55 |
file = librosa.load(path)
|
| 56 |
+
elif path.endswith(".jpg") or path.endswith(".jpeg"):
|
| 57 |
+
file = cv2.imread(path)
|
| 58 |
+
cv2.imshow('image', file)
|
| 59 |
elif path.endswith('.xlsx') or path.endswith('.xls'):
|
| 60 |
+
file = pd.read_excel(path).to_dict()
|
| 61 |
elif path.startswith('http'):
|
| 62 |
+
file = requests.get(path, timeout=10).text
|
| 63 |
else:
|
| 64 |
with open(path, "rb") as f:
|
| 65 |
+
file = f.readlines()
|
| 66 |
return file
|
| 67 |
|
| 68 |
def search_web(query: str) -> str:
|