kazutab commited on
Commit
90ae8fd
·
verified ·
1 Parent(s): 2c475e2

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +117 -35
app.py CHANGED
@@ -140,57 +140,139 @@ def generate_mindmap(input_text: str):
140
  custom_css = """
141
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
142
 
143
- body {
144
- font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
 
 
 
 
 
145
  background-color: #fafafa !important;
 
146
  }
147
 
148
- /* GradioのデフォルトUIを上書きしてガラス風のプレミアムデザイにする */
149
  .gradio-container {
150
- max-width: 1200px !important;
151
- margin: 0 auto !important;
152
- padding: 24px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
 
 
155
  #sidebar {
156
- background-color: #ffffff;
157
- border-radius: 12px;
158
- padding: 24px;
159
- box-shadow: 0 4px 20px rgba(0,0,0,0.04);
160
- border: 1px solid #eaeaea;
 
 
 
 
 
 
 
 
161
  }
162
 
 
163
  #canvas {
164
- background-color: #fafafa;
165
- border-radius: 12px;
166
- padding: 24px;
167
- border: 1px solid #eaeaea;
168
- background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
169
- background-size: 20px 20px;
170
- min-height: 600px;
171
- box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  }
173
 
 
 
 
 
 
 
 
174
  .submit-btn {
175
  background: #000000 !important;
176
  color: #ffffff !important;
177
- border-radius: 8px !important;
178
  font-weight: 500 !important;
179
- padding: 12px !important;
180
  border: none !important;
181
  transition: all 0.2s ease !important;
 
182
  }
183
 
184
  .submit-btn:hover {
185
  background: #333333 !important;
186
- transform: translateY(-1px);
187
  }
188
 
189
- textarea {
190
- border-radius: 8px !important;
191
- border: 1px solid #eaeaea !important;
192
- box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
193
- }
194
  """
195
 
196
  head_scripts = """
@@ -199,23 +281,23 @@ head_scripts = """
199
  <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader"></script>
200
  """
201
 
202
- with gr.Blocks(css=custom_css, head=head_scripts, theme=gr.themes.Default(primary_hue="zinc")) as demo:
203
- with gr.Row():
204
- with gr.Column(scale=3, elem_id="sidebar"):
205
- gr.Markdown("## 🧠 MindMap Studio")
206
- gr.Markdown("AIが入力された文章を分析し、論理的なマインドマップを自動生成します。\n\n*Hugging Face ZeroGPU Native Version*")
207
 
208
  text_input = gr.Textbox(
209
- lines=12,
210
  label="入力文章",
211
  placeholder="ここに議事録やニュース記事を入力してください...",
212
  elem_id="input-box"
213
  )
214
  submit_btn = gr.Button("マインドマップを生成", elem_classes="submit-btn")
215
 
216
- with gr.Column(scale=7, elem_id="canvas"):
217
  map_output = gr.HTML(
218
- "<div style='text-align:center; padding-top:200px; color:#a1a1aa; font-weight: 500;'>ここにマインドマップが表示されます</div>"
219
  )
220
 
221
  submit_btn.click(
 
140
  custom_css = """
141
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
142
 
143
+ /* 全体のリセットとフルスクリーン化 */
144
+ body, html {
145
+ margin: 0 !important;
146
+ padding: 0 !important;
147
+ height: 100vh !important;
148
+ overflow: hidden !important;
149
+ font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", "Helvetica Neue", sans-serif !important;
150
  background-color: #fafafa !important;
151
+ color: #171717 !important;
152
  }
153
 
154
+ /* Gradioのテナ制限を解除 */
155
  .gradio-container {
156
+ max-width: 100% !important;
157
+ padding: 0 !important;
158
+ margin: 0 !important;
159
+ height: 100vh !important;
160
+ border: none !important;
161
+ background: transparent !important;
162
+ }
163
+
164
+ /* フッターを隠す */
165
+ footer { display: none !important; }
166
+
167
+ /* 兄弟要素の隙間を消す */
168
+ .gap { gap: 0 !important; }
169
+ .wrap { padding: 0 !important; }
170
+ .contain { padding: 0 !important; margin: 0 !important; }
171
+ div.svelte-1y5yiv1 { padding: 0 !important; }
172
+ .svelte-1y5yiv1 { padding: 0 !important; }
173
+
174
+ /* メインレイアウト(RowをFlexにする) */
175
+ #main-row {
176
+ height: 100vh !important;
177
+ width: 100vw !important;
178
+ margin: 0 !important;
179
+ flex-wrap: nowrap !important;
180
+ display: flex !important;
181
  }
182
 
183
+ /* サイドバー */
184
  #sidebar {
185
+ width: 360px !important;
186
+ min-width: 360px !important;
187
+ max-width: 360px !important;
188
+ height: 100vh !important;
189
+ background-color: #ffffff !important;
190
+ border-right: 1px solid #eaeaea !important;
191
+ border-radius: 0 !important;
192
+ padding: 24px !important;
193
+ box-shadow: 1px 0 10px rgba(0,0,0,0.02) !important;
194
+ display: flex !important;
195
+ flex-direction: column !important;
196
+ gap: 20px !important;
197
+ overflow-y: auto !important;
198
  }
199
 
200
+ /* キャンバスエリア */
201
  #canvas {
202
+ flex-grow: 1 !important;
203
+ height: 100vh !important;
204
+ background-color: #fafafa !important;
205
+ border-radius: 0 !important;
206
+ border: none !important;
207
+ padding: 0 !important;
208
+ margin: 0 !important;
209
+ background-image: radial-gradient(#e5e7eb 1px, transparent 1px) !important;
210
+ background-size: 20px 20px !important;
211
+ position: relative !important;
212
+ overflow: hidden !important;
213
+ }
214
+
215
+ /* テキストの色を強制的に黒・グレーにする(ダークモードの影響を排除) */
216
+ #sidebar h2, #sidebar p, #sidebar span {
217
+ color: #171717 !important;
218
+ }
219
+
220
+ #sidebar p {
221
+ color: #666666 !important;
222
+ font-size: 14px !important;
223
+ }
224
+
225
+ /* テキストエリアのスタイリング */
226
+ #input-box textarea {
227
+ background-color: #ffffff !important;
228
+ color: #171717 !important;
229
+ border: 1px solid #eaeaea !important;
230
+ border-radius: 8px !important;
231
+ padding: 16px !important;
232
+ font-family: inherit !important;
233
+ font-size: 14px !important;
234
+ line-height: 1.6 !important;
235
+ box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
236
+ resize: none !important;
237
+ height: 200px !important;
238
+ }
239
+
240
+ #input-box textarea:focus {
241
+ border-color: #999 !important;
242
+ box-shadow: 0 0 0 4px rgba(0,0,0,0.08) !important;
243
+ outline: none !important;
244
+ }
245
+
246
+ #input-box textarea::placeholder {
247
+ color: #a1a1aa !important;
248
  }
249
 
250
+ #input-box label span {
251
+ color: #666666 !important;
252
+ font-weight: 500 !important;
253
+ font-size: 13px !important;
254
+ }
255
+
256
+ /* ボタンのスタイリング */
257
  .submit-btn {
258
  background: #000000 !important;
259
  color: #ffffff !important;
260
+ border-radius: 6px !important;
261
  font-weight: 500 !important;
262
+ padding: 12px 16px !important;
263
  border: none !important;
264
  transition: all 0.2s ease !important;
265
+ margin-top: 10px !important;
266
  }
267
 
268
  .submit-btn:hover {
269
  background: #333333 !important;
270
+ transform: translateY(-1px) !important;
271
  }
272
 
273
+ /* 隠しラベルなどを非表示 */
274
+ .form { border: none !important; background: transparent !important; box-shadow: none !important; }
275
+ .block { border: none !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; }
 
 
276
  """
277
 
278
  head_scripts = """
 
281
  <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader"></script>
282
  """
283
 
284
+ with gr.Blocks(css=custom_css, head=head_scripts, title="MindMap Studio") as demo:
285
+ with gr.Row(elem_id="main-row"):
286
+ with gr.Column(elem_id="sidebar"):
287
+ gr.Markdown("<h2 style='color: #171717; font-weight: 600; font-size: 20px; margin-bottom: 8px;'>🧠 MindMap Studio</h2>")
288
+ gr.Markdown("<p style='color: #666666; font-size: 14px; margin-bottom: 20px;'>AIが入力された文章を分析し、論理的なマインドマップを自動生成します。</p>")
289
 
290
  text_input = gr.Textbox(
291
+ lines=10,
292
  label="入力文章",
293
  placeholder="ここに議事録やニュース記事を入力してください...",
294
  elem_id="input-box"
295
  )
296
  submit_btn = gr.Button("マインドマップを生成", elem_classes="submit-btn")
297
 
298
+ with gr.Column(elem_id="canvas"):
299
  map_output = gr.HTML(
300
+ "<div style='width: 100%; height: 100vh; display: flex; align-items: center; justify-content: center; color: #a1a1aa; font-weight: 500;'>ここにマインドマップが表示されます</div>"
301
  )
302
 
303
  submit_btn.click(