Spaces:
Sleeping
Sleeping
Commit
·
0257d64
1
Parent(s):
a822c3b
adjust transparency
Browse files
gapp.py
CHANGED
@@ -126,7 +126,7 @@ h1 {
|
|
126 |
"""
|
127 |
demo = gr.Blocks(css = css)
|
128 |
with demo:
|
129 |
-
gr.Markdown("# 🌟 Process
|
130 |
state = gr.State(value={})
|
131 |
with gr.Row():
|
132 |
upl_btn = gr.UploadButton(label="Upload", file_types = ['.csv'], file_count = "single")
|
@@ -160,18 +160,18 @@ with demo:
|
|
160 |
pmchart = gr.Plot( label="Process Map")
|
161 |
ve_btn.click( fn=get_process_map_variants, inputs = [ top_k_variant_selector, state], outputs=[ pmchart, state])
|
162 |
|
163 |
-
with gr.Tab('Process Explorer'):
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
with gr.Tab('Process Model'):
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
|
176 |
|
177 |
if __name__ == "__main__":
|
|
|
126 |
"""
|
127 |
demo = gr.Blocks(css = css)
|
128 |
with demo:
|
129 |
+
gr.Markdown("# 🌟 Process Discovery 🌟")
|
130 |
state = gr.State(value={})
|
131 |
with gr.Row():
|
132 |
upl_btn = gr.UploadButton(label="Upload", file_types = ['.csv'], file_count = "single")
|
|
|
160 |
pmchart = gr.Plot( label="Process Map")
|
161 |
ve_btn.click( fn=get_process_map_variants, inputs = [ top_k_variant_selector, state], outputs=[ pmchart, state])
|
162 |
|
163 |
+
# with gr.Tab('Process Explorer'):
|
164 |
+
# pe_btn = gr.Button("Get Activities & Connections")
|
165 |
+
# with gr.Column():
|
166 |
+
# top_k_activity_selector = gr.Slider(0, 10, value=1, step=1, label="Activity", info="【pending】增減 Top Activity 數量(0: 全選)")
|
167 |
+
# top_k_connection_selector = gr.Slider(0, 10, value=1, step=1, label="Connection", info="增減 Top Connection 數量(0: 全選)")
|
168 |
+
# pmchart = gr.Plot( label="Process Map")
|
169 |
+
# pe_btn.click( fn=get_process_map_activities_connections, inputs = [ top_k_activity_selector, top_k_connection_selector, state], outputs=[ pmchart, state])
|
170 |
+
|
171 |
+
# with gr.Tab('Process Model'):
|
172 |
+
# cc_btn = gr.Button("Get Process Model")
|
173 |
+
# img = gr.Image( label="Process Model")
|
174 |
+
# cc_btn.click( fn=get_process_map, inputs = [state], outputs=[ img, state])
|
175 |
|
176 |
|
177 |
if __name__ == "__main__":
|
japp.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
+
|
8 |
+
html = '''
|
9 |
+
<button id="my_btn" onclick="click_text()">Hello</button>
|
10 |
+
'''
|
11 |
+
|
12 |
+
# script = '''
|
13 |
+
# function test(){
|
14 |
+
# let script = document.createElement('script');
|
15 |
+
# script.innerHTML = "function click_text(){alert('click')}";
|
16 |
+
# document.head.appendChild(script);
|
17 |
+
# }
|
18 |
+
# '''
|
19 |
+
script = '''
|
20 |
+
import G6 from '@antv/g6';
|
21 |
+
function click_text(){
|
22 |
+
const button = document.querySelector("#my_btn");
|
23 |
+
button.addEventListener("click", e => {
|
24 |
+
alert("Clicked")
|
25 |
+
})
|
26 |
+
}
|
27 |
+
'''
|
28 |
+
|
29 |
+
|
30 |
+
demo = gr.Blocks(js = script)
|
31 |
+
|
32 |
+
with demo:
|
33 |
+
gr.HTML(html)
|
34 |
+
# demo.load( js = script)
|
35 |
+
|
36 |
+
if __name__ == "__main__":
|
37 |
+
demo.launch(
|
38 |
+
server_name="0.0.0.0",
|
39 |
+
server_port=int(os.environ.get("PORT")),
|
40 |
+
auth=( os.environ.get("USER_NAME"), os.environ.get("PASSWORD"))
|
41 |
+
)
|
42 |
+
|
43 |
+
# block.close()
|
model.py
CHANGED
@@ -154,7 +154,7 @@ def view_networkx( nx_graph, layout):
|
|
154 |
mode='markers+text',
|
155 |
hovertext = [n for n in nx_graph.nodes],
|
156 |
textposition='top center',
|
157 |
-
marker=dict(size=
|
158 |
)
|
159 |
|
160 |
# Create edge lines
|
@@ -188,8 +188,8 @@ def view_networkx( nx_graph, layout):
|
|
188 |
showarrow=True,
|
189 |
arrowhead=2,
|
190 |
arrowsize=1,
|
191 |
-
arrowwidth=
|
192 |
-
arrowcolor='
|
193 |
)
|
194 |
)
|
195 |
|
@@ -212,5 +212,9 @@ def view_process_map( nx_graph, process_type: str = 'dfg', layout_type: str = 's
|
|
212 |
"""
|
213 |
"""
|
214 |
layout = nx.nx_agraph.graphviz_layout( nx_graph, prog=layout_type)
|
|
|
|
|
|
|
|
|
215 |
fig = view_networkx(nx_graph, layout)
|
216 |
return fig
|
|
|
154 |
mode='markers+text',
|
155 |
hovertext = [n for n in nx_graph.nodes],
|
156 |
textposition='top center',
|
157 |
+
marker=dict(size=20, color='LightSkyBlue', line=dict(width=2),opacity=0.5)
|
158 |
)
|
159 |
|
160 |
# Create edge lines
|
|
|
188 |
showarrow=True,
|
189 |
arrowhead=2,
|
190 |
arrowsize=1,
|
191 |
+
arrowwidth=5, # 增加箭头的宽度
|
192 |
+
arrowcolor='rgba(128, 128, 128, 0.5)'
|
193 |
)
|
194 |
)
|
195 |
|
|
|
212 |
"""
|
213 |
"""
|
214 |
layout = nx.nx_agraph.graphviz_layout( nx_graph, prog=layout_type)
|
215 |
+
# min_x, max_x = min([ node_loc[0] for node, node_loc in layout.items()]), max([ node_loc[0] for node, node_loc in layout.items()])
|
216 |
+
# min_y, max_y = min([ node_loc[1] for node, node_loc in layout.items()]), max([ node_loc[1] for node, node_loc in layout.items()])
|
217 |
+
# layout['#Start#'] = ( min_x, min_y)
|
218 |
+
# layout['#End#'] = (max_x, max_y)
|
219 |
fig = view_networkx(nx_graph, layout)
|
220 |
return fig
|