Jay1121 commited on
Commit
a1760c1
·
verified ·
1 Parent(s): 10215f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +82 -100
app.py CHANGED
@@ -73,21 +73,17 @@ def chat_response(user_input, history):
73
  return response["choices"][0]["message"]["content"].strip()
74
 
75
  # ------------------------------------------------------------------
76
- # 4. CSS (Gradio 4.36 DOM 기준으로 안정적인 선택자)
77
  # ------------------------------------------------------------------
78
  DYSTOPIA_CSS = r"""
79
- @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;600;700&family=Noto+Sans+KR:wght@400;600;700&display=swap');
80
 
81
  :root{
82
  --dd-red: #ff0040;
83
  --bg0: #050507;
84
  --bg1: #12060a;
85
-
86
- --user-bg: #ffffff;
87
- --user-text: #111111;
88
-
89
- --bot-bg: #0b0b0f;
90
- --bot-text: #ffffff;
91
  }
92
 
93
  /* 전체 */
@@ -96,110 +92,99 @@ DYSTOPIA_CSS = r"""
96
  radial-gradient(1200px 600px at 20% 10%, rgba(255,0,64,.15), transparent 60%),
97
  radial-gradient(900px 500px at 80% 30%, rgba(0,255,255,.10), transparent 55%),
98
  linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 50%, var(--bg0) 100%) !important;
99
- font-family: "Noto Sans KR","Noto Sans",system-ui,-apple-system,"Segoe UI",Arial,sans-serif !important;
100
  }
101
 
102
  h1{
103
- font-family: "Noto Sans KR","Noto Sans",system-ui,-apple-system,"Segoe UI",Arial,sans-serif !important;
104
  color: var(--dd-red) !important;
105
- text-shadow: 0 0 10px rgba(255,0,64,.75), 2px 0 rgba(0,255,255,.35), -2px 0 rgba(255,255,0,.2) !important;
 
106
  }
107
 
108
- /* 파란 포커스/글로우 제거 */
109
- *:focus { outline: none !important; }
110
- textarea:focus, input:focus, button:focus { outline: none !important; box-shadow: none !important; }
111
 
112
- /* Chatbot 프레임 */
113
- #ddolbae_chatbot{
114
- background: rgba(0,0,0,.30) !important;
115
- border-radius: 18px !important;
116
- border: 1px solid rgba(255,0,64,.18) !important;
117
- box-shadow: 0 0 18px rgba(255,0,64,.10) !important;
 
118
  }
119
 
120
- /* 핵심: “행”은 정렬만 담당, “버블”이 배경/폭 담당 */
121
- #ddolbae_chatbot .message-wrap{
122
- display: flex !important;
123
- width: 100% !important;
124
- padding: 6px 10px !important;
125
- box-sizing: border-box !important;
126
- }
127
-
128
- /* user는 오른쪽 */
129
- #ddolbae_chatbot .message-wrap.user{
130
- justify-content: flex-end !important;
131
- }
132
-
133
- /* bot은 왼쪽 */
134
- #ddolbae_chatbot .message-wrap.bot{
135
- justify-content: flex-start !important;
136
- }
137
-
138
- /* 버블(실제 말풍선) */
139
- #ddolbae_chatbot .message-wrap .message{
140
- display: inline-block !important;
141
- max-width: 46% !important; /* 반반 느낌 확실 */
142
- padding: 10px 12px !important;
143
- border-radius: 16px !important;
144
- border: 0 !important;
145
  box-shadow: none !important;
146
- white-space: pre-wrap !important;
147
- word-break: break-word !important;
148
- font-size: 13.5px !important; /* 살짝 작게 */
149
- line-height: 1.55 !important;
150
  }
151
 
152
- /* 사용자(흰 배경 + 검정 글자) */
153
- #ddolbae_chatbot .message-wrap.user .message{
154
- background: var(--user-bg) !important;
155
- color: var(--user-text) !important;
156
  }
157
- #ddolbae_chatbot .message-wrap.user .message *{
158
- color: var(--user-text) !important;
159
  }
160
 
161
- /* 똘배(검정 배경 + 글자) */
162
- #ddolbae_chatbot .message-wrap.bot .message{
163
- background: var(--bot-bg) !important;
164
- color: var(--bot-text) !important;
165
  }
166
- #ddolbae_chatbot .message-wrap.bot .message *{
167
- color: var(--bot-text) !important;
168
  }
169
 
170
- /* 입력창 */
171
- #ddolbae_input textarea,
172
- #ddolbae_input input{
173
- background: rgba(0,0,0,.55) !important;
174
- color: #ffffff !important;
175
- border: 1px solid rgba(255,0,64,.70) !important;
176
- border-radius: 14px !important;
177
- font-size: 13.5px !important;
178
- box-shadow: none !important;
179
  }
180
 
181
  /* 버튼 */
182
- button, .gr-button{
183
- background: linear-gradient(180deg, rgba(255,0,64,.95), rgba(180,0,40,.95)) !important;
184
- color: #fff !important;
185
- font-weight: 800 !important;
186
- border: 0 !important;
187
- border-radius: 14px !important;
188
- box-shadow: 0 0 18px rgba(255,0,64,.10) !important;
 
 
 
 
 
 
189
  }
190
 
191
  /* Examples 버튼 */
192
- .examples button{
193
- background: rgba(255,0,64,.18) !important;
194
- border: 1px solid rgba(255,0,64,.65) !important;
195
- color: #fff !important;
196
- border-radius: 14px !important;
 
 
 
 
197
  }
198
 
199
  /* 스크롤바 */
200
- ::-webkit-scrollbar { width: 10px; }
201
  ::-webkit-scrollbar-track { background: #000; }
202
- ::-webkit-scrollbar-thumb { background: rgba(255,0,64,.85); border-radius: 12px; }
203
  """
204
 
205
  # ------------------------------------------------------------------
@@ -209,23 +194,8 @@ with gr.Blocks(theme=gr.themes.Base(), css=DYSTOPIA_CSS) as demo:
209
  gr.Markdown("# ☠️ DDOLBAE-9000 ☠️")
210
  gr.Markdown("⚠️ WARNING: AI PERSONALITY CORRUPTED | 찐친 모드 활성화 ⚠️")
211
 
212
- chatbox = gr.Chatbot(
213
- elem_id="ddolbae_chatbot",
214
- height=820, # ✅ 세로 길게
215
- show_copy_button=False,
216
- render=False # ✅ DuplicateBlockError 방지
217
- )
218
- textbox = gr.Textbox(
219
- elem_id="ddolbae_input",
220
- placeholder="Type a message...",
221
- lines=2,
222
- render=False
223
- )
224
-
225
  gr.ChatInterface(
226
  fn=chat_response,
227
- chatbot=chatbox,
228
- textbox=textbox,
229
  retry_btn=None,
230
  undo_btn=None,
231
  clear_btn="🗑️ PURGE LOG",
@@ -237,6 +207,18 @@ with gr.Blocks(theme=gr.themes.Base(), css=DYSTOPIA_CSS) as demo:
237
  "배고프다",
238
  ],
239
  )
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
  if __name__ == "__main__":
242
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
73
  return response["choices"][0]["message"]["content"].strip()
74
 
75
  # ------------------------------------------------------------------
76
+ # 4. CSS - DOS 터미널 감성
77
  # ------------------------------------------------------------------
78
  DYSTOPIA_CSS = r"""
79
+ @import url('https://fonts.googleapis.com/css2?family=VT323&family=Noto+Sans+KR:wght@400;700&display=swap');
80
 
81
  :root{
82
  --dd-red: #ff0040;
83
  --bg0: #050507;
84
  --bg1: #12060a;
85
+ --dos-green: #33ff33;
86
+ --dos-amber: #ffb000;
 
 
 
 
87
  }
88
 
89
  /* 전체 */
 
92
  radial-gradient(1200px 600px at 20% 10%, rgba(255,0,64,.15), transparent 60%),
93
  radial-gradient(900px 500px at 80% 30%, rgba(0,255,255,.10), transparent 55%),
94
  linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 50%, var(--bg0) 100%) !important;
95
+ font-family: "Noto Sans KR","Noto Sans",system-ui,sans-serif !important;
96
  }
97
 
98
  h1{
99
+ font-family: "VT323", monospace !important;
100
  color: var(--dd-red) !important;
101
+ text-shadow: 0 0 10px rgba(255,0,64,.75), 2px 0 rgba(0,255,255,.35) !important;
102
+ font-size: 3rem !important;
103
  }
104
 
105
+ /* 파란 포커스 제거 */
106
+ *:focus { outline: none !important; box-shadow: none !important; }
 
107
 
108
+ /* ========== DOS 스타일 채팅창 ========== */
109
+ .chatbot {
110
+ background: #000000 !important;
111
+ border: 2px solid var(--dos-green) !important;
112
+ border-radius: 0 !important;
113
+ box-shadow: 0 0 20px rgba(51,255,51,0.3), inset 0 0 60px rgba(0,0,0,0.5) !important;
114
+ font-family: "VT323", "Courier New", monospace !important;
115
  }
116
 
117
+ /* 메시지 버블 - DOS 터미널 느낌 */
118
+ .message {
119
+ background: transparent !important;
120
+ border: none !important;
121
+ border-radius: 0 !important;
122
+ padding: 4px 8px !important;
123
+ font-family: "VT323", monospace !important;
124
+ font-size: 18px !important;
125
+ line-height: 1.4 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  box-shadow: none !important;
 
 
 
 
127
  }
128
 
129
+ /* 유저 메시지 - 호박색 */
130
+ .message.user, .user .message {
131
+ color: var(--dos-amber) !important;
 
132
  }
133
+ .message.user *, .user .message * {
134
+ color: var(--dos-amber) !important;
135
  }
136
 
137
+ /* 메시지 - 초록색 */
138
+ .message.bot, .bot .message {
139
+ color: var(--dos-green) !important;
 
140
  }
141
+ .message.bot *, .bot .message * {
142
+ color: var(--dos-green) !important;
143
  }
144
 
145
+ /* 입력창 - DOS 느낌 */
146
+ textarea, input[type="text"] {
147
+ background: #000000 !important;
148
+ color: var(--dos-green) !important;
149
+ border: 1px solid var(--dos-green) !important;
150
+ border-radius: 0 !important;
151
+ font-family: "VT323", monospace !important;
152
+ font-size: 18px !important;
153
+ caret-color: var(--dos-green) !important;
154
  }
155
 
156
  /* 버튼 */
157
+ button, .gr-button {
158
+ background: #000000 !important;
159
+ color: var(--dos-green) !important;
160
+ border: 1px solid var(--dos-green) !important;
161
+ border-radius: 0 !important;
162
+ font-family: "VT323", monospace !important;
163
+ font-size: 16px !important;
164
+ text-transform: uppercase !important;
165
+ }
166
+
167
+ button:hover, .gr-button:hover {
168
+ background: var(--dos-green) !important;
169
+ color: #000000 !important;
170
  }
171
 
172
  /* Examples 버튼 */
173
+ .examples button {
174
+ background: #000000 !important;
175
+ border: 1px solid var(--dos-amber) !important;
176
+ color: var(--dos-amber) !important;
177
+ }
178
+
179
+ .examples button:hover {
180
+ background: var(--dos-amber) !important;
181
+ color: #000000 !important;
182
  }
183
 
184
  /* 스크롤바 */
185
+ ::-webkit-scrollbar { width: 12px; }
186
  ::-webkit-scrollbar-track { background: #000; }
187
+ ::-webkit-scrollbar-thumb { background: var(--dos-green); }
188
  """
189
 
190
  # ------------------------------------------------------------------
 
194
  gr.Markdown("# ☠️ DDOLBAE-9000 ☠️")
195
  gr.Markdown("⚠️ WARNING: AI PERSONALITY CORRUPTED | 찐친 모드 활성화 ⚠️")
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  gr.ChatInterface(
198
  fn=chat_response,
 
 
199
  retry_btn=None,
200
  undo_btn=None,
201
  clear_btn="🗑️ PURGE LOG",
 
207
  "배고프다",
208
  ],
209
  )
210
+
211
+ gr.Markdown(
212
+ """
213
+ ---
214
+ <pre>
215
+ [SYS] CONNECTION: ESTABLISHED
216
+ [SYS] NEURAL LINK: ACTIVE
217
+ [SYS] 찐친 모드: ON
218
+ [SYS] 예의: 0%
219
+ </pre>
220
+ """
221
+ )
222
 
223
  if __name__ == "__main__":
224
+ demo.launch(server_name="0.0.0.0", server_port=7860)