Spaces:
Runtime error
Runtime error
Create reader.py
Browse files
reader.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from yattag import Doc
|
3 |
+
|
4 |
+
## --------------------------------- ###
|
5 |
+
### creating html ###
|
6 |
+
### -------------------------------- ###
|
7 |
+
def get_article(acc, feats):
|
8 |
+
|
9 |
+
title = 'Potential Buyer Fit Analysis'
|
10 |
+
description = 'How Well Does a Partner with the Selected Characteristics Fit?'
|
11 |
+
|
12 |
+
# use yattag library to generate html
|
13 |
+
doc, tag, text, line = Doc().ttl()
|
14 |
+
|
15 |
+
# create html for accuracy and feature weight
|
16 |
+
with tag('div'):
|
17 |
+
with tag('div', klass='model-container'):
|
18 |
+
with tag('div', klass='box model-div'):
|
19 |
+
line('h2', "Model Accuracy", klass='acc-feat')
|
20 |
+
line('p', acc, klass='num')
|
21 |
+
with tag('div', klass='box model-div'):
|
22 |
+
line('h2', "Feature Weight", klass='acc-feat')
|
23 |
+
line('p', "1. " + feats[0], klass='num')
|
24 |
+
line('p', "2. " + feats[1], klass='num')
|
25 |
+
line('p', "3. " + feats[2], klass='num')
|
26 |
+
line('p', "4. " + feats[3], klass='num')
|
27 |
+
|
28 |
+
css = '''
|
29 |
+
.component {
|
30 |
+
margin-bottom: 20px;
|
31 |
+
}
|
32 |
+
|
33 |
+
.panel-button {
|
34 |
+
background-color: #7f7f7f !important;
|
35 |
+
border: solid 1px #7f7f7f !important;
|
36 |
+
color: #FFFFFF !important;
|
37 |
+
margin: 5px;
|
38 |
+
box-shadow: 0px 9px 0px #2a2b2b !important;
|
39 |
+
transition: all .2s ease-out 0s !important;
|
40 |
+
}
|
41 |
+
|
42 |
+
.panel-button:hover {
|
43 |
+
box-shadow: 0 5px #00AEAB;
|
44 |
+
transform: translateY(5px);
|
45 |
+
}
|
46 |
+
|
47 |
+
.submit {
|
48 |
+
background-color: #dd2184 !important;
|
49 |
+
border: solid 1px #dd2184 !important;
|
50 |
+
box-shadow: 0px 9px 0px #c14c89 !important;
|
51 |
+
}
|
52 |
+
|
53 |
+
.radio-item {
|
54 |
+
transition: margin-top 0.3s ease, box-shadow 0.3s ease;
|
55 |
+
transition: background-color 0.3s, color 0.3s;
|
56 |
+
background-color: #c9e7fb !important;
|
57 |
+
border: solid 1px #c9e7fb;
|
58 |
+
margin: 5px;
|
59 |
+
box-shadow: 0px 9px 0px #66bbf4;
|
60 |
+
white-space: normal !important;
|
61 |
+
gap: 2px !important;
|
62 |
+
}
|
63 |
+
|
64 |
+
.selected {
|
65 |
+
transition: margin-top 0.2s ease, box-shadow 0.2s ease;
|
66 |
+
margin-top:9px;
|
67 |
+
margin: 5px !important;
|
68 |
+
box-shadow: 0px 9px 0px #3482c5 !important;
|
69 |
+
border: solid 1px #7db9eb !important;
|
70 |
+
background-color: #7db9eb !important;
|
71 |
+
}
|
72 |
+
|
73 |
+
.panel-header {
|
74 |
+
background-color: #37aae0;
|
75 |
+
color: #FFFFFF !important;
|
76 |
+
padding: 5px !important;
|
77 |
+
}
|
78 |
+
|
79 |
+
.radio-item:hover {
|
80 |
+
background-color: #7db9eb !important;
|
81 |
+
border: solid 1px #7db9eb;
|
82 |
+
box-shadow: 0px 9px 0px #3482c5 !important;
|
83 |
+
color: #FFFFFF;
|
84 |
+
}
|
85 |
+
'''
|
86 |
+
|
87 |
+
css += '''
|
88 |
+
.panel {
|
89 |
+
background-image: url("https://imageio.forbes.com/specials-images/imageserve/5ed6636cdd5d320006caf841/The-Blackout-Tuesday-movement-is-causing-Instagram-feeds-to-turn-black-/960x0.jpg?fit=bounds&format=jpg&width=960");
|
90 |
+
background-size: 650px 400px !important;
|
91 |
+
background-position: center;
|
92 |
+
background-repeat: no-repeat;
|
93 |
+
}
|
94 |
+
|
95 |
+
.output-text {
|
96 |
+
border-radius: 20px;
|
97 |
+
text-align: center;
|
98 |
+
}
|
99 |
+
|
100 |
+
.duration {
|
101 |
+
visibility: hidden !important;
|
102 |
+
}
|
103 |
+
|
104 |
+
.box {
|
105 |
+
background-color: #7f7f7f !important;
|
106 |
+
margin: 10px;
|
107 |
+
padding: 5px;
|
108 |
+
}
|
109 |
+
|
110 |
+
.acc-feat {
|
111 |
+
color: #FFFFFF !important;
|
112 |
+
}
|
113 |
+
|
114 |
+
.num {
|
115 |
+
margin-top: 3px;
|
116 |
+
margin-left: 10%;
|
117 |
+
margin-right: 3%;
|
118 |
+
padding: 5px;
|
119 |
+
border-radius: 15px;
|
120 |
+
background-color: #FFFFFF !important;
|
121 |
+
text-align: right;
|
122 |
+
}
|
123 |
+
|
124 |
+
.description {
|
125 |
+
text-align: center;
|
126 |
+
}
|
127 |
+
|
128 |
+
.model-container {
|
129 |
+
display: flex;
|
130 |
+
justify-content: space-around !important;
|
131 |
+
}
|
132 |
+
|
133 |
+
.model-div {
|
134 |
+
width: 40%;
|
135 |
+
}
|
136 |
+
|
137 |
+
.flex-wrap {
|
138 |
+
flex-wrap: nowrap !important;
|
139 |
+
}
|
140 |
+
'''
|
141 |
+
|
142 |
+
return {
|
143 |
+
'article': doc.getvalue(),
|
144 |
+
'css': css,
|
145 |
+
'title': title,
|
146 |
+
'description': description,
|
147 |
+
}
|