Update threshold Excel label for clarity, adjust visibility settings for pagination controls, and modify demo launch settings to recommend disabling sharing in Hugging Face Spaces.
Browse files
app.py
CHANGED
|
@@ -725,7 +725,7 @@ with gr.Blocks(css="""
|
|
| 725 |
|
| 726 |
with gr.Row():
|
| 727 |
csv_uploader = gr.File(label="① 時系列CSV(3行ヘッダー)", file_count="single", file_types=[".csv"])
|
| 728 |
-
thr_uploader = gr.File(label="② 閾値Excel(任意: LL/L/
|
| 729 |
|
| 730 |
with gr.Row():
|
| 731 |
thr_mode = gr.Radio(
|
|
@@ -755,11 +755,11 @@ with gr.Blocks(css="""
|
|
| 755 |
|
| 756 |
msg = gr.Markdown()
|
| 757 |
# 表示領域:Plot 1枚を使い回す(個別=ページ分割も同じPlotを再描画)
|
| 758 |
-
plot = gr.Plot(label="トレンド図(タグ別)",
|
| 759 |
# ページ分割用コントロール(個別モード時のみ使用)
|
| 760 |
with gr.Row():
|
| 761 |
-
tags_per_page = gr.Slider(1, 12, value=8, step=1, label="タグ/ページ(個別モード)")
|
| 762 |
-
page_no = gr.Number(value=1, label="ページ(1〜)", precision=0)
|
| 763 |
page_info = gr.Markdown(visible=False)
|
| 764 |
|
| 765 |
# コールバック接続
|
|
@@ -793,6 +793,16 @@ with gr.Blocks(css="""
|
|
| 793 |
outputs=[msg, plot, page_info, page_no],
|
| 794 |
)
|
| 795 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
if __name__ == "__main__":
|
| 797 |
-
#
|
| 798 |
-
demo.launch(ssr_mode=False
|
|
|
|
| 725 |
|
| 726 |
with gr.Row():
|
| 727 |
csv_uploader = gr.File(label="① 時系列CSV(3行ヘッダー)", file_count="single", file_types=[".csv"])
|
| 728 |
+
thr_uploader = gr.File(label="② 閾値Excel(任意: LL/L/H/HH)", file_count="single", file_types=[".xlsx", ".xls"])
|
| 729 |
|
| 730 |
with gr.Row():
|
| 731 |
thr_mode = gr.Radio(
|
|
|
|
| 755 |
|
| 756 |
msg = gr.Markdown()
|
| 757 |
# 表示領域:Plot 1枚を使い回す(個別=ページ分割も同じPlotを再描画)
|
| 758 |
+
plot = gr.Plot(label="トレンド図(タグ別)", visible=True)
|
| 759 |
# ページ分割用コントロール(個別モード時のみ使用)
|
| 760 |
with gr.Row():
|
| 761 |
+
tags_per_page = gr.Slider(1, 12, value=8, step=1, label="タグ/ページ(個別モード)", visible=False)
|
| 762 |
+
page_no = gr.Number(value=1, label="ページ(1〜)", precision=0, visible=False)
|
| 763 |
page_info = gr.Markdown(visible=False)
|
| 764 |
|
| 765 |
# コールバック接続
|
|
|
|
| 793 |
outputs=[msg, plot, page_info, page_no],
|
| 794 |
)
|
| 795 |
|
| 796 |
+
# 6) 表示形式に応じたコントロール表示切替(Blocks内で結線)
|
| 797 |
+
def _toggle_page_controls(mode):
|
| 798 |
+
show = str(mode).startswith("個別")
|
| 799 |
+
return gr.update(visible=show), gr.update(visible=show), gr.update(visible=show)
|
| 800 |
+
display_mode.change(
|
| 801 |
+
_toggle_page_controls,
|
| 802 |
+
inputs=[display_mode],
|
| 803 |
+
outputs=[tags_per_page, page_no, page_info],
|
| 804 |
+
)
|
| 805 |
+
|
| 806 |
if __name__ == "__main__":
|
| 807 |
+
# Hugging Face Spacesでは share=True 警告が出るため外すのがおすすめ
|
| 808 |
+
demo.launch(ssr_mode=False)
|