Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import numpy as np
|
| 2 |
import os
|
| 3 |
import re
|
|
|
|
|
|
|
| 4 |
# --- 依赖导入 ---
|
| 5 |
|
| 6 |
from model import CAFN
|
|
@@ -129,6 +131,8 @@ def show_results_for_site(evt: gr.SelectData, state_data):
|
|
| 129 |
k_index_str = evt.value[1]
|
| 130 |
k_index = int(k_index_str)
|
| 131 |
|
|
|
|
|
|
|
| 132 |
|
| 133 |
# 从状态字典中获取结果
|
| 134 |
result_dict = state_data.get(k_index)
|
|
@@ -137,7 +141,18 @@ def show_results_for_site(evt: gr.SelectData, state_data):
|
|
| 137 |
site_info = f"Prediction results for the segment centered at 'K' at position {k_index + 1}:"
|
| 138 |
return result_dict, site_info
|
| 139 |
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
# 如果没有选择或出现错误
|
| 142 |
return None, "Please click on the highlighted 'K' site in the sequence above to view the results."
|
| 143 |
|
|
@@ -168,6 +183,13 @@ IPKEQGVLSFWRGNLANVIRYFPTQALNFAFKDKYKQIFLGGVDKRTQFWLYFAGNLASG
|
|
| 168 |
results_output = gr.Label(num_top_classes=4, label="After clicking on the colored 'K' site, the results will be displayed here")
|
| 169 |
|
| 170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
gr.Markdown("---")
|
| 172 |
gr.Markdown("### Visualized Sequence")
|
| 173 |
# 使用 a[class='predictable-k'] 来应用CSS
|
|
@@ -182,4 +204,4 @@ IPKEQGVLSFWRGNLANVIRYFPTQALNFAFKDKYKQIFLGGVDKRTQFWLYFAGNLASG
|
|
| 182 |
)
|
| 183 |
|
| 184 |
# 启动应用
|
| 185 |
-
demo.launch(debug=True)
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import os
|
| 3 |
import re
|
| 4 |
+
|
| 5 |
+
|
| 6 |
# --- 依赖导入 ---
|
| 7 |
|
| 8 |
from model import CAFN
|
|
|
|
| 131 |
k_index_str = evt.value[1]
|
| 132 |
k_index = int(k_index_str)
|
| 133 |
|
| 134 |
+
|
| 135 |
+
|
| 136 |
|
| 137 |
# 从状态字典中获取结果
|
| 138 |
result_dict = state_data.get(k_index)
|
|
|
|
| 141 |
site_info = f"Prediction results for the segment centered at 'K' at position {k_index + 1}:"
|
| 142 |
return result_dict, site_info
|
| 143 |
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
# 如果没有选择或出现错误
|
| 157 |
return None, "Please click on the highlighted 'K' site in the sequence above to view the results."
|
| 158 |
|
|
|
|
| 183 |
results_output = gr.Label(num_top_classes=4, label="After clicking on the colored 'K' site, the results will be displayed here")
|
| 184 |
|
| 185 |
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
|
| 193 |
gr.Markdown("---")
|
| 194 |
gr.Markdown("### Visualized Sequence")
|
| 195 |
# 使用 a[class='predictable-k'] 来应用CSS
|
|
|
|
| 204 |
)
|
| 205 |
|
| 206 |
# 启动应用
|
| 207 |
+
demo.launch(debug=True)
|