Spaces:
Sleeping
Sleeping
CB commited on
Update streamlit_app.py
Browse files- streamlit_app.py +7 -2
streamlit_app.py
CHANGED
|
@@ -254,14 +254,16 @@ safety_settings = [
|
|
| 254 |
]
|
| 255 |
|
| 256 |
# ---- Upload & processing helpers ----
|
| 257 |
-
def upload_video_sdk(filepath: str):
|
| 258 |
key = get_effective_api_key()
|
| 259 |
if not key:
|
| 260 |
raise RuntimeError("No API key provided")
|
| 261 |
if not HAS_GENAI or upload_file is None:
|
| 262 |
raise RuntimeError("google.generativeai SDK not available; cannot upload")
|
| 263 |
genai.configure(api_key=key)
|
| 264 |
-
|
|
|
|
|
|
|
| 265 |
|
| 266 |
def wait_for_processed(file_obj, timeout: int = None):
|
| 267 |
if timeout is None:
|
|
@@ -440,6 +442,9 @@ if generate_now and not st.session_state.get("busy"):
|
|
| 440 |
local_path = current_path
|
| 441 |
upload_path, compressed = compress_video_if_large(local_path, threshold_mb=st.session_state.get("compress_threshold_mb", 200))
|
| 442 |
|
|
|
|
|
|
|
|
|
|
| 443 |
with st.spinner(f"Uploading video{' (compressed)' if compressed else ''}..."):
|
| 444 |
try:
|
| 445 |
uploaded = upload_video_sdk(upload_path)
|
|
|
|
| 254 |
]
|
| 255 |
|
| 256 |
# ---- Upload & processing helpers ----
|
| 257 |
+
def upload_video_sdk(filepath: str, rag_store_name: str = "default_store"):
|
| 258 |
key = get_effective_api_key()
|
| 259 |
if not key:
|
| 260 |
raise RuntimeError("No API key provided")
|
| 261 |
if not HAS_GENAI or upload_file is None:
|
| 262 |
raise RuntimeError("google.generativeai SDK not available; cannot upload")
|
| 263 |
genai.configure(api_key=key)
|
| 264 |
+
|
| 265 |
+
# Include the ragStoreName parameter
|
| 266 |
+
return upload_file(filepath, ragStoreName=rag_store_name)
|
| 267 |
|
| 268 |
def wait_for_processed(file_obj, timeout: int = None):
|
| 269 |
if timeout is None:
|
|
|
|
| 442 |
local_path = current_path
|
| 443 |
upload_path, compressed = compress_video_if_large(local_path, threshold_mb=st.session_state.get("compress_threshold_mb", 200))
|
| 444 |
|
| 445 |
+
# Set rag_store_name here
|
| 446 |
+
rag_store_name = "your_rag_store_name" # Adjust this value as needed
|
| 447 |
+
|
| 448 |
with st.spinner(f"Uploading video{' (compressed)' if compressed else ''}..."):
|
| 449 |
try:
|
| 450 |
uploaded = upload_video_sdk(upload_path)
|