Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -302,7 +302,6 @@ def toggle_view(mode, search_res, saved_data):
|
|
| 302 |
else:
|
| 303 |
return format_df(saved_data, saved_data), gr.update(visible=False)
|
| 304 |
|
| 305 |
-
# 🌟 修正後的初始化函式:不接受參數,自己去讀資料,並回傳 (State, DataFrame)
|
| 306 |
def init_on_load():
|
| 307 |
data = load_data()
|
| 308 |
return data, format_df(data, data)
|
|
@@ -311,12 +310,29 @@ def init_on_load():
|
|
| 311 |
|
| 312 |
with gr.Blocks(title="Prof.404 開箱教授去哪兒?", theme=gr.themes.Soft()) as demo:
|
| 313 |
|
| 314 |
-
# 🌟 State 初始化為空,等待 load 事件觸發更新
|
| 315 |
saved_state = gr.State([])
|
| 316 |
search_res_state = gr.State([])
|
| 317 |
selected_prof_state = gr.State(None)
|
| 318 |
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
with gr.Row():
|
| 322 |
search_input = gr.Textbox(label="搜尋研究領域", placeholder="例如: 大型語言模型, 後量子密碼遷移...", scale=4)
|
|
@@ -369,7 +385,6 @@ with gr.Blocks(title="Prof.404 開箱教授去哪兒?", theme=gr.themes.Soft()
|
|
| 369 |
|
| 370 |
# --- Wiring ---
|
| 371 |
|
| 372 |
-
# 🌟 頁面載入時觸發:執行 init_on_load -> 更新 saved_state 和 prof_df
|
| 373 |
demo.load(init_on_load, inputs=None, outputs=[saved_state, prof_df])
|
| 374 |
|
| 375 |
search_btn.click(
|
|
|
|
| 302 |
else:
|
| 303 |
return format_df(saved_data, saved_data), gr.update(visible=False)
|
| 304 |
|
|
|
|
| 305 |
def init_on_load():
|
| 306 |
data = load_data()
|
| 307 |
return data, format_df(data, data)
|
|
|
|
| 310 |
|
| 311 |
with gr.Blocks(title="Prof.404 開箱教授去哪兒?", theme=gr.themes.Soft()) as demo:
|
| 312 |
|
|
|
|
| 313 |
saved_state = gr.State([])
|
| 314 |
search_res_state = gr.State([])
|
| 315 |
selected_prof_state = gr.State(None)
|
| 316 |
|
| 317 |
+
# 🌟 這裡插入了您要求的徽章與文字,使用 HTML 置中
|
| 318 |
+
gr.Markdown("""
|
| 319 |
+
<div align="center">
|
| 320 |
+
|
| 321 |
+
# 🎓 Prof.404 - 開箱教授去哪兒? (API KEY RPD,建議自行 Fork)
|
| 322 |
+
|
| 323 |
+
[](https://huggingface.co/spaces/DeepLearning101/Prof.404)
|
| 324 |
+
[](https://github.com/Deep-Learning-101/prof-404)
|
| 325 |
+
[](https://opensource.org/licenses/MIT)
|
| 326 |
+
[](https://deepmind.google/technologies/gemini/)
|
| 327 |
+
|
| 328 |
+
👉 歡迎 Star ⭐ GitHub 👆 👆 HuggingFace ⭐ 覺得不錯 👈
|
| 329 |
+
|
| 330 |
+
**學術研究啟程的導航系統,拒絕當科研路上的無頭蒼蠅**
|
| 331 |
+
|
| 332 |
+
**(全新升級:支援雲端同步!Space 重啟資料不遺失 🔄)**
|
| 333 |
+
|
| 334 |
+
</div>
|
| 335 |
+
""")
|
| 336 |
|
| 337 |
with gr.Row():
|
| 338 |
search_input = gr.Textbox(label="搜尋研究領域", placeholder="例如: 大型語言模型, 後量子密碼遷移...", scale=4)
|
|
|
|
| 385 |
|
| 386 |
# --- Wiring ---
|
| 387 |
|
|
|
|
| 388 |
demo.load(init_on_load, inputs=None, outputs=[saved_state, prof_df])
|
| 389 |
|
| 390 |
search_btn.click(
|