Spaces:
Running
Running
Fix Gradio TypeError and improve stability
Browse files
.git.bfg-report/2025-06-23/16-51-48/cache-stats.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(apply,CacheStats{hitCount=28, missCount=33, loadSuccessCount=33, loadExceptionCount=0, totalLoadTime=47715790, evictionCount=0})
|
2 |
+
(tree,CacheStats{hitCount=42, missCount=31, loadSuccessCount=26, loadExceptionCount=0, totalLoadTime=35716500, evictionCount=0})
|
3 |
+
(commit,CacheStats{hitCount=16, missCount=17, loadSuccessCount=17, loadExceptionCount=0, totalLoadTime=23264831, evictionCount=0})
|
4 |
+
(tag,CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0})
|
.git.bfg-report/2025-06-23/16-51-48/deleted-files.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
b464e0844c71e081ff52a56c9e0185fae1e7f091 13499 20241128Target.csv
|
2 |
+
12fd4bc63187592eaf8774619ed93039bc22b0b8 1675002 JRCT20241128Cancer.csv
|
3 |
+
75193609202daad74bf20574efa2998d033f2525 1970586 JRCT20241129Cancer.csv
|
4 |
+
fddba4eb2ea34774796ea8b29fe2d3c5e9ca29d7 170866 JRCT20241129sarcoma.csv
|
5 |
+
38ddf366adc69aaa790a1fd518b34a4184bca2e7 2145242 JRCT20241130Cancer.csv
|
6 |
+
b0a38d3d7fab4c7f875e63fc8e61fd2e883923a8 7812338 JRCT20241202Cancer.csv
|
7 |
+
516fa4643149c94329bbc483b5a10902c2d8bb50 6089937 JRCT20241215Cancer.csv
|
8 |
+
f50413b6c21e28436c8a2a98d53126f3c3dd9d6f 16738554 JRCT20241215CancerPost.csv
|
9 |
+
5d19c61671ad4a07c27a9c26f36a622615b7d267 5954 filtered_data.csv
|
10 |
+
730debd9e9ba9dc2ac5626ca140b8e6c9df0cd47 17860 filtered_data.csv
|
11 |
+
b75b1891e46b333a806998ed0670f72990ab87fa 7047 filtered_data.csv
|
12 |
+
521959385eee36afaa7154e0de234a4b4cc8903f 82505 full_data.csv
|
13 |
+
8fdf03175b47be64ae2ed2ebe5b4ae1992d536b6 18116 full_data.csv
|
14 |
+
f3358b9c5f9982181fbeaa76338f565d514bb204 554548 gabage.csv
|
15 |
+
12fd4bc63187592eaf8774619ed93039bc22b0b8 1675002 gabage2.csv
|
16 |
+
7b67b253c4ff1c46aefc8e1fe077f60a305aaa8a 14676 jrct_study_details.csv
|
17 |
+
fb703460324947bd463cd2f65cac708120958cdf 14676 jrct_study_details_sorted.csv
|
18 |
+
de2d3993c2cd54737d31957c415453da81487643 232783 search_results.csv
|
19 |
+
337e17ce3d67969cdd60ad5e93a85e7463bff8a6 56852 search_results_by_disease.csv
|
.git.bfg-report/2025-06-23/16-51-48/object-id-map.old-new.txt
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
0797974c74057dc6ed0652c10397fe406137cc79 c7eeac38c180a542e847dec46aeb107d6fe9b84e
|
2 |
+
0ba503353ee01978adf67cb3c1a739e4f0bb06fe 48faf27f0b97a0087c93a0ef51ec14b360dabb50
|
3 |
+
13c338b00b1b73d8842b1c46a64675d650e9cf4e 7fca98388c807c9b7ddcff3f152c9344779ad4cd
|
4 |
+
22080a3381a6aa5c1b76e8c53892495d826718f9 b61435bf9946fc903c1b33fb7495205fd3f23867
|
5 |
+
237fa0cd85c1690ba505d37faae8e979cfc0f1bd 7ca49264e87618909fa22c8ae968fbd983f8dd92
|
6 |
+
261509480e033c67ef05fb30c5d0c2bc3a87cb7e f518c5de1e1dc28e41092645771ad55ff30bec44
|
7 |
+
297e7d03294eb116094bb11f26024657340704d4 038beaaa517fa6f59d39bb1ae1036155f5903444
|
8 |
+
2a514584dfd56a13c17e6ee53db8659d87d427ae 609dc6f4f6bae3e01095b91f21093414cba92f49
|
9 |
+
346553b1cee5637b6cb8255a0754d8a16e53173e cda178084e61cd3e1a989fb68dd64ac1fa65a9fe
|
10 |
+
38c4bfa323a1df4f45f37e44f771d6387299df13 9754890d41c02bdb50799c2707fb9de84c0e6860
|
11 |
+
4580ede17fa414544c8ed2a9ca767d1a150e5d2d d482f8aa1492471cc38c11f08e7adc89d7471052
|
12 |
+
58ec5ce8e3c913288ea1e78a1fe032d66727c3e3 01943499ef6f2ad15cbba6214bc7132f007f3475
|
13 |
+
607e784d359cf9a27b7e2469283910abfba6788c 3b8c537ee004c85637e7c9350deaeb10712f2899
|
14 |
+
64f1100e6792b595111b77559eef93aac7754083 b197ea7d981c2d5db892b10b036ba7ce9f48a5c0
|
15 |
+
6aa59d5213477c76f109bde275c4a09a0d4b744c c6aed6bb4545e1948f24f9e1ecd83c000da518eb
|
16 |
+
70efc484b5e53393208b5a45b7ba3a4ffae328d4 186df2a4d53101dd52aa91aa6b6f2d8c8c64ffb9
|
17 |
+
711435f7d9cf08a3f7cc1cd8c95416106239b077 889ceea57aec099e77914f48920114b5dc0e6061
|
18 |
+
716d761ada81248a969bf923ac8fe30202447ef8 61fc341c13d62a14915ab15faefce853c222dadb
|
19 |
+
762af33b479df8e9cc83f457a13b65bf54fc2052 582fe32c4c00632d4126f9d23221f8762b1ddd06
|
20 |
+
7a7fb6b970d53a5deeb142dc36e2444ee76f339d ed168a29d6f59ec5e697b0cfd605e281c766ed23
|
21 |
+
851acc509e5883e09d6c5e24a88336e267207c8b 28e581089a801b0088c01a81e22f4cb9957f0aa8
|
22 |
+
8821fa60d6515bd8e67b261de3d49c44664e4213 2c55c5cb0a4c4abe33ad41d5e9e829d4bfe66854
|
23 |
+
93a8a42eae2230f318120c35b312b36228020400 cdf25f87cb1f8a76246d2efd9c1e386c60c9715f
|
24 |
+
a365b9f3d54a1d8ea73acf7634fc5b32b8163597 6e966edc2daa26012c6bd5402f00e0beced10c0b
|
25 |
+
a90cca107bdb3db94f511554467d9bd3fcd65f40 b7861975f522768177fd66a8018cb53d886cae1f
|
26 |
+
b1c5aa958f57d63ef9d7697b40969478bb8f5a52 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
27 |
+
b5e551e3b25168b8b2eec6f061370f6c641ed511 dbc7e29201dfaab5ab34f98ff3347f16bc278fa6
|
28 |
+
b6ec3f056fc9fd68440799885b5d526ce02976a6 e9b37f5a633c3b16eb6bf29fafa06710776a5c0b
|
29 |
+
b9d517bac19e2c63e257c2c49d8fd92fbcab87ae 9f571a822c12ac00b13d828845eff79b811dd7b7
|
30 |
+
c2a739dc75dda3ab395e644e0b26d686f8656c29 1f37be00bba46733c20b21bbfeced31add3880df
|
31 |
+
c40e2fdd99ccc62cdd86bb7dde6df0226e27397a 732008b0a808f045abb04b1e90e7b38cd25ee4b6
|
32 |
+
ce4a4e74fb9aaf3dbc21423facecf0302e9d2f07 022ace251bfe5a104fd37f43bc3d31127a5d9a40
|
33 |
+
e2a058da6eb944b4ceb1e6ad48ea306cf10963fa 4c22c2d9f7e321d5e1defb12190d3c0ce3f00d16
|
34 |
+
ef1ef39d2f416d74f6261c5e8b4af5c8b22ce18d 72e5b07d3c3d84f08e3892d7bcdc101d022d695b
|
35 |
+
ef705be363fe72fe3d84e04eb9451938f4746f61 528c560653246b068eafe9f00a1b257477fe18a5
|
36 |
+
fffb1d5ae59c5dc54d91a2c4c431f2262231eb90 25a52ce55cd567bcd71a3f384d8473979f5b839b
|
app.py
CHANGED
@@ -135,21 +135,10 @@ def generate_dataframe(age, sex, tumor_type, GeneMutation, Meseable, Biopsiable)
|
|
135 |
traceback.print_exc()
|
136 |
return pd.DataFrame(), pd.DataFrame()
|
137 |
|
138 |
-
# 特定のAgentGrade(yes, no, unclear)に基づいて行をフィルタリングする関数
|
139 |
-
def filter_rows_by_grade(original_df, grade):
|
140 |
-
try:
|
141 |
-
if original_df is None or original_df.empty:
|
142 |
-
return pd.DataFrame(), pd.DataFrame()
|
143 |
-
df_filtered = original_df[original_df['AgentGrade'] == grade]
|
144 |
-
return df_filtered, df_filtered
|
145 |
-
except Exception as e:
|
146 |
-
print(f"フィルタリングエラー: {e}")
|
147 |
-
return pd.DataFrame(), pd.DataFrame()
|
148 |
-
|
149 |
# CSVとして保存しダウンロードする関数
|
150 |
def download_filtered_csv(df):
|
151 |
try:
|
152 |
-
if df is None or df
|
153 |
return None
|
154 |
file_path = "filtered_data.csv"
|
155 |
df.to_csv(file_path, index=False)
|
@@ -161,7 +150,7 @@ def download_filtered_csv(df):
|
|
161 |
# 全体結果をCSVとして保存しダウンロードする関数
|
162 |
def download_full_csv(df):
|
163 |
try:
|
164 |
-
if df is None or df
|
165 |
return None
|
166 |
file_path = "full_data.csv"
|
167 |
df.to_csv(file_path, index=False)
|
@@ -171,69 +160,110 @@ def download_full_csv(df):
|
|
171 |
return None
|
172 |
|
173 |
# Gradioインターフェースの作成
|
174 |
-
with gr.Blocks() as demo:
|
175 |
gr.Markdown("## 臨床試験適格性評価インターフェース")
|
176 |
gr.Markdown("⚠️ **注意**: サーバーエラーが発生する場合があります。エラーが続く場合は少し時間をおいてから再試行してください。")
|
177 |
|
178 |
# 各種入力フィールド
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
185 |
|
186 |
# データフレーム表示エリア
|
187 |
-
dataframe_output = gr.DataFrame(
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
193 |
|
194 |
-
#
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
|
206 |
# ボタン動作の設定
|
207 |
generate_button.click(
|
208 |
-
fn=
|
209 |
-
inputs=[age_input, sex_input, tumor_type_input, gene_mutation_input, measurable_input, biopsiable_input],
|
210 |
-
outputs=[dataframe_output,
|
211 |
)
|
|
|
212 |
yes_button.click(
|
213 |
-
fn=
|
214 |
-
inputs=[
|
215 |
-
outputs=[dataframe_output,
|
216 |
)
|
|
|
217 |
no_button.click(
|
218 |
-
fn=
|
219 |
-
inputs=[
|
220 |
-
outputs=[dataframe_output,
|
221 |
)
|
|
|
222 |
unclear_button.click(
|
223 |
-
fn=
|
224 |
-
inputs=[
|
225 |
-
outputs=[dataframe_output,
|
226 |
)
|
|
|
227 |
download_filtered_button.click(
|
228 |
-
fn=download_filtered_csv,
|
229 |
-
inputs=
|
230 |
-
outputs=download_filtered_output
|
231 |
)
|
|
|
232 |
download_full_button.click(
|
233 |
-
fn=download_full_csv,
|
234 |
-
inputs=
|
235 |
-
outputs=download_full_output
|
236 |
)
|
237 |
|
238 |
if __name__ == "__main__":
|
239 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
traceback.print_exc()
|
136 |
return pd.DataFrame(), pd.DataFrame()
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
# CSVとして保存しダウンロードする関数
|
139 |
def download_filtered_csv(df):
|
140 |
try:
|
141 |
+
if df is None or len(df) == 0:
|
142 |
return None
|
143 |
file_path = "filtered_data.csv"
|
144 |
df.to_csv(file_path, index=False)
|
|
|
150 |
# 全体結果をCSVとして保存しダウンロードする関数
|
151 |
def download_full_csv(df):
|
152 |
try:
|
153 |
+
if df is None or len(df) == 0:
|
154 |
return None
|
155 |
file_path = "full_data.csv"
|
156 |
df.to_csv(file_path, index=False)
|
|
|
160 |
return None
|
161 |
|
162 |
# Gradioインターフェースの作成
|
163 |
+
with gr.Blocks(title="臨床試験適格性評価", theme=gr.themes.Soft()) as demo:
|
164 |
gr.Markdown("## 臨床試験適格性評価インターフェース")
|
165 |
gr.Markdown("⚠️ **注意**: サーバーエラーが発生する場合があります。エラーが続く場合は少し時間をおいてから再試行してください。")
|
166 |
|
167 |
# 各種入力フィールド
|
168 |
+
with gr.Row():
|
169 |
+
with gr.Column():
|
170 |
+
age_input = gr.Textbox(label="Age", placeholder="例: 65", value="")
|
171 |
+
sex_input = gr.Dropdown(choices=["男性", "女性"], label="Sex", value=None)
|
172 |
+
tumor_type_input = gr.Textbox(label="Tumor Type", placeholder="例: gastric cancer", value="")
|
173 |
+
|
174 |
+
with gr.Column():
|
175 |
+
gene_mutation_input = gr.Textbox(label="Gene Mutation", placeholder="例: HER2", value="")
|
176 |
+
measurable_input = gr.Dropdown(choices=["有り", "無し", "不明"], label="Measurable Tumor", value=None)
|
177 |
+
biopsiable_input = gr.Dropdown(choices=["有り", "無し", "不明"], label="Biopsiable Tumor", value=None)
|
178 |
|
179 |
# データフレーム表示エリア
|
180 |
+
dataframe_output = gr.DataFrame(
|
181 |
+
headers=["NCTID", "AgentGrade", "Title", "AgentJudgment", "Status"],
|
182 |
+
datatype=["str", "str", "str", "str", "str"],
|
183 |
+
value=None
|
184 |
+
)
|
185 |
+
|
186 |
+
# 内部状態用の非表示コンポーネント
|
187 |
+
original_df_state = gr.State(value=None)
|
188 |
+
filtered_df_state = gr.State(value=None)
|
189 |
|
190 |
+
# ボタン類
|
191 |
+
with gr.Row():
|
192 |
+
generate_button = gr.Button("Generate Clinical Trials Data", variant="primary")
|
193 |
+
|
194 |
+
with gr.Row():
|
195 |
+
yes_button = gr.Button("Show Eligible Trials", variant="secondary")
|
196 |
+
no_button = gr.Button("Show Ineligible Trials", variant="secondary")
|
197 |
+
unclear_button = gr.Button("Show Unclear Trials", variant="secondary")
|
198 |
|
199 |
+
with gr.Row():
|
200 |
+
download_filtered_button = gr.Button("Download Filtered Data")
|
201 |
+
download_full_button = gr.Button("Download Full Data")
|
202 |
+
|
203 |
+
# ダウンロードファイル
|
204 |
+
download_filtered_output = gr.File(label="Download Filtered Data", visible=False)
|
205 |
+
download_full_output = gr.File(label="Download Full Data", visible=False)
|
206 |
+
|
207 |
+
# イベントハンドリング
|
208 |
+
def update_dataframe_and_state(age, sex, tumor_type, gene_mutation, measurable, biopsiable):
|
209 |
+
"""データフレーム生成と状態更新"""
|
210 |
+
df, _ = generate_dataframe(age, sex, tumor_type, gene_mutation, measurable, biopsiable)
|
211 |
+
return df, df, df
|
212 |
|
213 |
+
def filter_and_update(original_df, grade):
|
214 |
+
"""フィルタリングと表示更新"""
|
215 |
+
if original_df is None or len(original_df) == 0:
|
216 |
+
return original_df, original_df
|
217 |
+
|
218 |
+
try:
|
219 |
+
df_filtered = original_df[original_df['AgentGrade'] == grade]
|
220 |
+
return df_filtered, df_filtered
|
221 |
+
except Exception as e:
|
222 |
+
print(f"フィルタリングエラー: {e}")
|
223 |
+
return original_df, original_df
|
224 |
|
225 |
# ボタン動作の設定
|
226 |
generate_button.click(
|
227 |
+
fn=update_dataframe_and_state,
|
228 |
+
inputs=[age_input, sex_input, tumor_type_input, gene_mutation_input, measurable_input, biopsiable_input],
|
229 |
+
outputs=[dataframe_output, original_df_state, filtered_df_state]
|
230 |
)
|
231 |
+
|
232 |
yes_button.click(
|
233 |
+
fn=lambda df: filter_and_update(df, "yes"),
|
234 |
+
inputs=[original_df_state],
|
235 |
+
outputs=[dataframe_output, filtered_df_state]
|
236 |
)
|
237 |
+
|
238 |
no_button.click(
|
239 |
+
fn=lambda df: filter_and_update(df, "no"),
|
240 |
+
inputs=[original_df_state],
|
241 |
+
outputs=[dataframe_output, filtered_df_state]
|
242 |
)
|
243 |
+
|
244 |
unclear_button.click(
|
245 |
+
fn=lambda df: filter_and_update(df, "unclear"),
|
246 |
+
inputs=[original_df_state],
|
247 |
+
outputs=[dataframe_output, filtered_df_state]
|
248 |
)
|
249 |
+
|
250 |
download_filtered_button.click(
|
251 |
+
fn=download_filtered_csv,
|
252 |
+
inputs=[filtered_df_state],
|
253 |
+
outputs=[download_filtered_output]
|
254 |
)
|
255 |
+
|
256 |
download_full_button.click(
|
257 |
+
fn=download_full_csv,
|
258 |
+
inputs=[original_df_state],
|
259 |
+
outputs=[download_full_output]
|
260 |
)
|
261 |
|
262 |
if __name__ == "__main__":
|
263 |
+
demo.launch(
|
264 |
+
server_name="0.0.0.0",
|
265 |
+
server_port=7860,
|
266 |
+
share=False,
|
267 |
+
debug=False,
|
268 |
+
show_error=True
|
269 |
+
)
|
requirements.txt
CHANGED
@@ -1,42 +1,40 @@
|
|
1 |
-
# Core web framework
|
2 |
-
gradio
|
3 |
|
4 |
# Data processing
|
5 |
pandas>=1.5.0
|
6 |
numpy>=1.21.0
|
7 |
requests>=2.25.0
|
8 |
|
9 |
-
# LangChain ecosystem (
|
10 |
-
langchain
|
11 |
-
langchain-community
|
12 |
-
langchain-core
|
13 |
-
langchain-openai
|
14 |
-
langchain-groq
|
15 |
-
langchain-text-splitters
|
16 |
|
17 |
# LLM providers
|
18 |
openai>=1.0.0
|
19 |
groq>=0.4.0
|
20 |
|
21 |
-
# Vector databases and embeddings
|
22 |
-
chromadb>=0.4.0
|
23 |
-
sentence-transformers>=2.2.0
|
24 |
-
|
25 |
# Database utilities
|
26 |
SQLAlchemy>=2.0.0,<3.0.0
|
27 |
|
28 |
-
# Pydantic (
|
29 |
pydantic>=2.0.0,<3.0.0
|
30 |
|
31 |
-
# Text processing
|
32 |
tiktoken>=0.4.0
|
33 |
-
tokenizers>=0.19.0
|
34 |
-
transformers>=4.40.0
|
35 |
|
36 |
# Utilities
|
37 |
tenacity>=8.0.0
|
38 |
packaging>=23.0.0
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Optional: Bio-related libraries (if needed for your specific use case)
|
42 |
# Uncomment the following lines if bio-processing is required
|
|
|
1 |
+
# Core web framework (固定バージョンで安定性確保)
|
2 |
+
gradio==4.44.0
|
3 |
|
4 |
# Data processing
|
5 |
pandas>=1.5.0
|
6 |
numpy>=1.21.0
|
7 |
requests>=2.25.0
|
8 |
|
9 |
+
# LangChain ecosystem (安定バージョンに固定)
|
10 |
+
langchain==0.3.2
|
11 |
+
langchain-community==0.3.1
|
12 |
+
langchain-core==0.3.9
|
13 |
+
langchain-openai==0.2.2
|
14 |
+
langchain-groq==0.2.0
|
15 |
+
langchain-text-splitters==0.3.0
|
16 |
|
17 |
# LLM providers
|
18 |
openai>=1.0.0
|
19 |
groq>=0.4.0
|
20 |
|
|
|
|
|
|
|
|
|
21 |
# Database utilities
|
22 |
SQLAlchemy>=2.0.0,<3.0.0
|
23 |
|
24 |
+
# Pydantic (Gradio互換性のため)
|
25 |
pydantic>=2.0.0,<3.0.0
|
26 |
|
27 |
+
# Text processing (軽量化)
|
28 |
tiktoken>=0.4.0
|
|
|
|
|
29 |
|
30 |
# Utilities
|
31 |
tenacity>=8.0.0
|
32 |
packaging>=23.0.0
|
33 |
+
|
34 |
+
# Optional: Vector databases (必要な場合のみ)
|
35 |
+
# chromadb>=0.4.0
|
36 |
+
# sentence-transformers>=2.2.0
|
37 |
+
# transformers>=4.40.0
|
38 |
|
39 |
# Optional: Bio-related libraries (if needed for your specific use case)
|
40 |
# Uncomment the following lines if bio-processing is required
|