awacke1 commited on
Commit
64ee824
·
1 Parent(s): fe96929

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +168 -0
app.py CHANGED
@@ -1,4 +1,172 @@
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  edge [xdir=back arrowtail=odiamond]
3
  Subsystem_1 -> "Shared resource" [xlabel=aggregation]
4
  {Subsystem_2 Subsystem_3 } -> "Shared resource"
 
1
 
2
+ import time
3
+ import re
4
+ import pandas as pd
5
+ import numpy as np
6
+ import torch
7
+ import torch.nn.functional as F
8
+ import graphviz as graphviz
9
+ import pydeck as pdk
10
+ import streamlit as st
11
+
12
+ from transformers import AutoTokenizer, AutoModel
13
+ from tokenizers import Tokenizer, AddedToken
14
+ from st_click_detector import click_detector
15
+
16
+ st.graphviz_chart('''
17
+ digraph G2 {
18
+ node [shape=plaintext];
19
+ struct1 [label=<<TABLE>
20
+ <TR><TD><IMG SRC="1.png"></IMG></TD></TR>
21
+ <TR><TD>caption</TD></TR>
22
+ </TABLE>>];
23
+ }
24
+ ''')
25
+
26
+
27
+ st.graphviz_chart('''
28
+ digraph G {
29
+ rankdir=LR
30
+ node [shape=plaintext]
31
+ a [
32
+ label=<
33
+ <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
34
+ <TR><TD ROWSPAN="3" BGCOLOR="yellow">class</TD></TR>
35
+ <TR><TD PORT="here" BGCOLOR="lightblue">qualifier</TD></TR>
36
+ </TABLE>>
37
+ ]
38
+ b [shape=ellipse style=filled
39
+ label=<
40
+ <TABLE BGCOLOR="bisque">
41
+ <TR>
42
+ <TD COLSPAN="3">elephant</TD>
43
+ <TD ROWSPAN="2" BGCOLOR="chartreuse"
44
+ VALIGN="bottom" ALIGN="right">two</TD>
45
+ </TR>
46
+ <TR>
47
+ <TD COLSPAN="2" ROWSPAN="2">
48
+ <TABLE BGCOLOR="grey">
49
+ <TR><TD>corn</TD></TR>
50
+ <TR><TD BGCOLOR="yellow">c</TD></TR>
51
+ <TR><TD>f</TD></TR>
52
+ </TABLE>
53
+ </TD>
54
+ <TD BGCOLOR="white">penguin</TD>
55
+ </TR>
56
+ <TR>
57
+ <TD COLSPAN="2" BORDER="4" ALIGN="right" PORT="there">4</TD>
58
+ </TR>
59
+ </TABLE>>
60
+ ]
61
+ c [
62
+ label=<long line 1<BR/>line 2<BR ALIGN="LEFT"/>line 3<BR ALIGN="RIGHT"/>>
63
+ ]
64
+ subgraph { rank=same b c }
65
+ a:here -> b:there [dir=both arrowtail=diamond]
66
+ c -> b
67
+ d [shape=triangle]
68
+ d -> c [label=<
69
+ <TABLE>
70
+ <TR>
71
+ <TD BGCOLOR="red" WIDTH="10"> </TD>
72
+ <TD>Edge labels<BR/>also</TD>
73
+ <TD BGCOLOR="blue" WIDTH="10"> </TD>
74
+ </TR>
75
+ </TABLE>>
76
+ ]
77
+ }
78
+ ''')
79
+
80
+ st.graphviz_chart('''
81
+ digraph R {
82
+ rankdir=LR
83
+ node [style=rounded]
84
+ node1 [shape=box]
85
+ node2 [fillcolor=yellow, style="rounded,filled", shape=diamond]
86
+ node3 [shape=record, label="{ a | b | c }"]
87
+ node1 -> node2 -> node3
88
+ }
89
+ ''')
90
+
91
+
92
+ st.graphviz_chart('''
93
+ digraph structs {
94
+ node [shape=record];
95
+ struct1 [label="<f0> left|<f1> mid&#92; dle|<f2> right"];
96
+ struct2 [label="<f0> one|<f1> two"];
97
+ struct3 [label="hello&#92;nworld |{ b |{c|<here> d|e}| f}| g | h"];
98
+ struct1:f1 -> struct2:f0;
99
+ struct1:f2 -> struct3:here;
100
+ }
101
+ ''')
102
+
103
+ st.graphviz_chart('''
104
+ graph G {
105
+ fontname="Helvetica,Arial,sans-serif"
106
+ node [fontname="Helvetica,Arial,sans-serif"]
107
+ edge [fontname="Helvetica,Arial,sans-serif"]
108
+ layout=fdp
109
+ e
110
+ subgraph clusterA {
111
+ a -- b;
112
+ subgraph clusterC {
113
+ C -- D;
114
+ }
115
+ }
116
+ subgraph clusterB {
117
+ d -- f
118
+ }
119
+ d -- D
120
+ e -- clusterB
121
+ clusterC -- clusterB
122
+ }
123
+ ''')
124
+
125
+ st.graphviz_chart('''
126
+ graph Transparency {
127
+ layout=neato
128
+ start=11 // empiric value to set orientation
129
+ bgcolor="#0000ff11"
130
+ node [shape=circle width=2.22 label="" style=filled]
131
+ 5 [color="#0000ff80"]
132
+ 6 [color="#ee00ee80"]
133
+ 1 [color="#ff000080"]
134
+ 2 [color="#eeee0080"]
135
+ 3 [color="#00ff0080"]
136
+ 4 [color="#00eeee80"]
137
+ 1 -- 2 -- 3 -- 4 -- 5 -- 6 -- 1
138
+ }
139
+ ''')
140
+
141
+ st.graphviz_chart('''
142
+ digraph UML_Class_diagram {
143
+ fontname="Helvetica,Arial,sans-serif"
144
+ node [fontname="Helvetica,Arial,sans-serif"]
145
+ edge [fontname="Helvetica,Arial,sans-serif"]
146
+ labelloc="t"
147
+ label="UML Class diagram demo"
148
+ graph [splines=false]
149
+ node [shape=record style=filled fillcolor=gray95]
150
+ edge [arrowhead=vee style=dashed]
151
+ Client -> Interface1 [xlabel=dependency]
152
+ Client -> Interface2
153
+ edge [dir=back arrowtail=empty style=""]
154
+ Interface1 -> Class1 [xlabel=inheritance]
155
+ Interface2 -> Class1 [dir=none]
156
+ Interface2 [label="" xlabel="Simple\ninterface" shape=circle]
157
+ Interface1[label = <{<b>«interface» I/O</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
158
+ Class1[label = <{<b>I/O class</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
159
+ edge [dir=back arrowtail=empty style=dashed]
160
+ Class1 -> System_1 [xlabel=implementation]
161
+ System_1 [label = <{<b>System</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
162
+ "Shared resource" [label = <{<b>Shared resource</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
163
+ edge [dir=back arrowtail=diamond]
164
+ "System_1" -> Subsystem_1 [xlabel="composition"]
165
+ Subsystem_1[label = <{<b>Subsystem 1</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
166
+ Subsystem_2[label = <{<b>Subsystem 2</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
167
+ Subsystem_3[label = <{<b>Subsystem 3</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
168
+ "System_1" -> Subsystem_2
169
+ "System_1" -> Subsystem_3
170
  edge [xdir=back arrowtail=odiamond]
171
  Subsystem_1 -> "Shared resource" [xlabel=aggregation]
172
  {Subsystem_2 Subsystem_3 } -> "Shared resource"