Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import gradio as gr
|
|
7 |
from google import genai
|
8 |
from google.genai import types
|
9 |
from google.genai.types import Tool, GoogleSearch
|
10 |
-
from huggingface_hub import create_repo,
|
11 |
|
12 |
# βββ Configuration βββ
|
13 |
MODEL_ID = "gemini-2.5-flash-preview-04-17"
|
@@ -96,14 +96,13 @@ def handle_message(user_msg, state):
|
|
96 |
with open(dest, "w", encoding="utf-8") as f:
|
97 |
f.write(content)
|
98 |
|
99 |
-
# Commit the snapshot
|
100 |
logs.append("Uploading snapshot to Hugging Face...")
|
101 |
-
|
|
|
|
|
102 |
repo_id=state["repo_id"],
|
103 |
-
repo_type="space"
|
104 |
-
token=state["hf_token"],
|
105 |
-
folder=state["local_path"],
|
106 |
-
commit_message="Update from assistant"
|
107 |
)
|
108 |
logs.append("Snapshot upload complete.")
|
109 |
|
|
|
7 |
from google import genai
|
8 |
from google.genai import types
|
9 |
from google.genai.types import Tool, GoogleSearch
|
10 |
+
from huggingface_hub import create_repo, HfApi
|
11 |
|
12 |
# βββ Configuration βββ
|
13 |
MODEL_ID = "gemini-2.5-flash-preview-04-17"
|
|
|
96 |
with open(dest, "w", encoding="utf-8") as f:
|
97 |
f.write(content)
|
98 |
|
99 |
+
# Commit the snapshot via HfApi.upload_folder
|
100 |
logs.append("Uploading snapshot to Hugging Face...")
|
101 |
+
api = HfApi(token=state["hf_token"])
|
102 |
+
api.upload_folder(
|
103 |
+
folder_path=state["local_path"],
|
104 |
repo_id=state["repo_id"],
|
105 |
+
repo_type="space"
|
|
|
|
|
|
|
106 |
)
|
107 |
logs.append("Snapshot upload complete.")
|
108 |
|