bluenevus commited on
Commit
d1d0218
·
1 Parent(s): 627be21

Update app.py via AI Editor

Browse files
Files changed (1) hide show
  1. app.py +122 -112
app.py CHANGED
@@ -41,124 +41,134 @@ document_types = {
41
 
42
  def get_right_col_content(selected_type):
43
  if selected_type == "Shred":
44
- return [
45
- html.Div([
46
- html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
47
- ], style={'textAlign':'center', 'marginBottom':'10px'}),
48
- dcc.Loading(
49
- id="loading-indicator",
50
- type="dot",
51
- children=[html.Div(id="loading-output")]
52
- ),
53
- html.Div(id='document-preview', className="border p-3 mb-3"),
54
- dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
55
- dcc.Download(id="download-document"),
56
- html.Hr(),
57
- dcc.Loading(
58
- id="chat-loading",
59
- type="dot",
60
- children=[
61
- dbc.Input(id="chat-input", type="text", placeholder="Chat with AI to update document...", className="mb-2", style={'whiteSpace':'pre-wrap'}),
62
- dbc.Button("Send", id="btn-send-chat", color="primary", className="mb-3"),
63
- html.Div(id="chat-output")
64
- ]
65
- )
66
- ]
67
- else:
68
- return [
69
- html.Div([
70
- html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
71
- ], style={'textAlign':'center', 'marginBottom':'10px'}),
72
- dcc.Loading(
73
- id="loading-indicator",
74
- type="dot",
75
- children=[html.Div(id="loading-output")]
76
- ),
77
- html.Div(id='document-preview', className="border p-3 mb-3"),
78
- dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
79
- dcc.Download(id="download-document"),
80
- html.Hr(),
81
- html.Div([
82
- html.Label(f"Upload {selected_type} Document"),
83
- dcc.Upload(
84
- id={'type': 'upload-doc-type', 'index': selected_type},
85
- children=html.Div(['Drag and Drop or ', html.A('Select File')]),
86
- style={
87
- 'width': '100%',
88
- 'height': '60px',
89
- 'lineHeight': '60px',
90
- 'borderWidth': '1px',
91
- 'borderStyle': 'dashed',
92
- 'borderRadius': '5px',
93
- 'textAlign': 'center',
94
- 'margin': '10px 0'
95
- },
96
- multiple=False
97
  ),
98
- html.Div(id={'type': 'uploaded-doc-name', 'index': selected_type}),
99
- dbc.RadioItems(
100
- id={'type': 'radio-doc-source', 'index': selected_type},
101
- options=[
102
- {'label': 'Loaded Document', 'value': 'loaded'},
103
- {'label': 'Uploaded Document', 'value': 'uploaded'}
104
- ],
105
- value='loaded',
106
- inline=True,
107
- className="mb-2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ),
109
- dbc.Button("Generate Document", id={'type': 'btn-generate-doc', 'index': selected_type}, color="primary", className="mb-3"),
110
- ], id={'type': 'doc-type-controls', 'index': selected_type}),
111
- dcc.Loading(
112
- id="chat-loading",
113
- type="dot",
114
- children=[
115
- dbc.Input(id="chat-input", type="text", placeholder="Chat with AI to update document...", className="mb-2", style={'whiteSpace':'pre-wrap'}),
116
- dbc.Button("Send", id="btn-send-chat", color="primary", className="mb-3"),
117
- html.Div(id="chat-output")
118
- ]
119
- )
120
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  app.layout = dbc.Container([
123
  dbc.Row([
124
- dbc.Col([
125
- html.H4("Proposal Documents", className="mt-3 mb-4"),
126
- html.Div([
127
- html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
128
- ], style={'textAlign':'center', 'marginBottom':'10px'}),
129
- dcc.Upload(
130
- id='upload-document',
131
- children=html.Div([
132
- 'Drag and Drop or ',
133
- html.A('Select Files')
134
- ]),
135
- style={
136
- 'width': '100%',
137
- 'height': '60px',
138
- 'lineHeight': '60px',
139
- 'borderWidth': '1px',
140
- 'borderStyle': 'dashed',
141
- 'borderRadius': '5px',
142
- 'textAlign': 'center',
143
- 'margin': '10px 0'
144
- },
145
- multiple=True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  ),
147
- html.Div(id='file-list'),
148
- html.Hr(),
149
- html.Div([
150
- dbc.Button(
151
- doc_type,
152
- id={'type': 'btn-doc-type', 'index': doc_type},
153
- color="link",
154
- className="mb-2 w-100 text-left custom-button",
155
- style={'overflow': 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap'}
156
- ) for doc_type in document_types.keys()
157
- ])
158
- ], width=3),
159
- dbc.Col([
160
- html.Div(id='right-col-content')
161
- ], width=9)
162
  ])
163
  ], fluid=True)
164
 
 
41
 
42
  def get_right_col_content(selected_type):
43
  if selected_type == "Shred":
44
+ return dbc.Card(
45
+ dbc.CardBody([
46
+ html.Div([
47
+ html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
48
+ ], style={'textAlign':'center', 'marginBottom':'10px'}),
49
+ dcc.Loading(
50
+ id="loading-indicator",
51
+ type="dot",
52
+ children=[html.Div(id="loading-output")]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  ),
54
+ html.Div(id='document-preview', className="border p-3 mb-3"),
55
+ dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
56
+ dcc.Download(id="download-document"),
57
+ html.Hr(),
58
+ dcc.Loading(
59
+ id="chat-loading",
60
+ type="dot",
61
+ children=[
62
+ dbc.Input(id="chat-input", type="text", placeholder="Chat with AI to update document...", className="mb-2", style={'whiteSpace':'pre-wrap'}),
63
+ dbc.Button("Send", id="btn-send-chat", color="primary", className="mb-3"),
64
+ html.Div(id="chat-output")
65
+ ]
66
+ )
67
+ ])
68
+ )
69
+ else:
70
+ return dbc.Card(
71
+ dbc.CardBody([
72
+ html.Div([
73
+ html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
74
+ ], style={'textAlign':'center', 'marginBottom':'10px'}),
75
+ dcc.Loading(
76
+ id="loading-indicator",
77
+ type="dot",
78
+ children=[html.Div(id="loading-output")]
79
  ),
80
+ html.Div(id='document-preview', className="border p-3 mb-3"),
81
+ dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
82
+ dcc.Download(id="download-document"),
83
+ html.Hr(),
84
+ html.Div([
85
+ html.Label(f"Upload {selected_type} Document"),
86
+ dcc.Upload(
87
+ id={'type': 'upload-doc-type', 'index': selected_type},
88
+ children=html.Div(['Drag and Drop or ', html.A('Select File')]),
89
+ style={
90
+ 'width': '100%',
91
+ 'height': '60px',
92
+ 'lineHeight': '60px',
93
+ 'borderWidth': '1px',
94
+ 'borderStyle': 'dashed',
95
+ 'borderRadius': '5px',
96
+ 'textAlign': 'center',
97
+ 'margin': '10px 0'
98
+ },
99
+ multiple=False
100
+ ),
101
+ html.Div(id={'type': 'uploaded-doc-name', 'index': selected_type}),
102
+ dbc.RadioItems(
103
+ id={'type': 'radio-doc-source', 'index': selected_type},
104
+ options=[
105
+ {'label': 'Loaded Document', 'value': 'loaded'},
106
+ {'label': 'Uploaded Document', 'value': 'uploaded'}
107
+ ],
108
+ value='loaded',
109
+ inline=True,
110
+ className="mb-2"
111
+ ),
112
+ dbc.Button("Generate Document", id={'type': 'btn-generate-doc', 'index': selected_type}, color="primary", className="mb-3"),
113
+ ], id={'type': 'doc-type-controls', 'index': selected_type}),
114
+ dcc.Loading(
115
+ id="chat-loading",
116
+ type="dot",
117
+ children=[
118
+ dbc.Input(id="chat-input", type="text", placeholder="Chat with AI to update document...", className="mb-2", style={'whiteSpace':'pre-wrap'}),
119
+ dbc.Button("Send", id="btn-send-chat", color="primary", className="mb-3"),
120
+ html.Div(id="chat-output")
121
+ ]
122
+ )
123
+ ])
124
+ )
125
 
126
  app.layout = dbc.Container([
127
  dbc.Row([
128
+ dbc.Col(
129
+ dbc.Card(
130
+ dbc.CardBody([
131
+ html.H4("Proposal Documents", className="mt-3 mb-4"),
132
+ html.Div([
133
+ html.Div(className="blinking-dot", style={'margin':'0 auto','width':'16px','height':'16px'}),
134
+ ], style={'textAlign':'center', 'marginBottom':'10px'}),
135
+ dcc.Upload(
136
+ id='upload-document',
137
+ children=html.Div([
138
+ 'Drag and Drop or ',
139
+ html.A('Select Files')
140
+ ]),
141
+ style={
142
+ 'width': '100%',
143
+ 'height': '60px',
144
+ 'lineHeight': '60px',
145
+ 'borderWidth': '1px',
146
+ 'borderStyle': 'dashed',
147
+ 'borderRadius': '5px',
148
+ 'textAlign': 'center',
149
+ 'margin': '10px 0'
150
+ },
151
+ multiple=True
152
+ ),
153
+ html.Div(id='file-list'),
154
+ html.Hr(),
155
+ html.Div([
156
+ dbc.Button(
157
+ doc_type,
158
+ id={'type': 'btn-doc-type', 'index': doc_type},
159
+ color="link",
160
+ className="mb-2 w-100 text-left custom-button",
161
+ style={'overflow': 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap'}
162
+ ) for doc_type in document_types.keys()
163
+ ])
164
+ ])
165
  ),
166
+ width=3
167
+ ),
168
+ dbc.Col(
169
+ html.Div(id='right-col-content'),
170
+ width=9
171
+ )
 
 
 
 
 
 
 
 
 
172
  ])
173
  ], fluid=True)
174