DDDDEvvvvv commited on
Commit
c2010b0
·
verified ·
1 Parent(s): 20c7e89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +86 -13
app.py CHANGED
@@ -16,7 +16,7 @@ def respond(message):
16
  last_msgs = history[-3:]
17
  input_text = " ".join([m["content"] for m in last_msgs])
18
  inputs = tokenizer(input_text, return_tensors="pt").to(device)
19
- outputs = model.generate(**inputs, max_new_tokens=100, do_sample=True, top_p=0.9)
20
  response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
21
  history.append({"role": "assistant", "content": response_text})
22
  return history
@@ -27,20 +27,93 @@ def reset_chat():
27
  return history
28
 
29
  css = """
30
- body {background-color: #000 !important; color: #fff !important;}
31
- .gr-chatbot {background-color: #111 !important; border-radius: 12px; height: 100% !important;}
32
- .gr-chatbot .message.user {border-color: #0ff; background-color: transparent !important;}
33
- .gr-chatbot .message.bot {border-color: #aaa; background-color: transparent !important;}
34
- .gr-textbox textarea {background-color: transparent !important; color: #fff !important; border: 1px solid #555 !important;}
35
- .gr-textbox textarea::selection {background-color: #0ff !important; color: #000 !important;}
36
- .gr-button {background-color: #0ff !important; color: #000 !important; border-radius: 8px;}
37
- footer {display: none !important;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  """
39
 
40
- with gr.Blocks(css=css) as demo:
41
- chatbot = gr.Chatbot(label="DevMegaBlack")
42
- msg = gr.Textbox(placeholder="Say something...")
43
- reset_btn = gr.Button("Reset Chat")
 
 
 
 
 
 
 
 
44
  msg.submit(respond, msg, chatbot)
45
  reset_btn.click(reset_chat, [], chatbot)
46
 
 
16
  last_msgs = history[-3:]
17
  input_text = " ".join([m["content"] for m in last_msgs])
18
  inputs = tokenizer(input_text, return_tensors="pt").to(device)
19
+ outputs = model.generate(**inputs, max_new_tokens=120, do_sample=True, top_p=0.9)
20
  response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
21
  history.append({"role": "assistant", "content": response_text})
22
  return history
 
27
  return history
28
 
29
  css = """
30
+ :root {
31
+ --accent: #00e5ff;
32
+ }
33
+
34
+ body {
35
+ background: #000 !important;
36
+ color: #fff !important;
37
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
38
+ }
39
+
40
+ .gradio-container {
41
+ max-width: 100% !important;
42
+ }
43
+
44
+ .gr-chatbot {
45
+ background: rgba(255,255,255,0.03) !important;
46
+ border-radius: 16px;
47
+ padding: 12px;
48
+ height: 100% !important;
49
+ box-shadow: inset 0 0 20px rgba(255,255,255,0.03);
50
+ }
51
+
52
+ .gr-chatbot .message {
53
+ border: none !important;
54
+ margin: 10px 0;
55
+ padding: 12px 14px;
56
+ border-radius: 14px;
57
+ backdrop-filter: blur(6px);
58
+ line-height: 1.5;
59
+ }
60
+
61
+ .gr-chatbot .message.user {
62
+ background: linear-gradient(
63
+ 135deg,
64
+ rgba(0,229,255,0.15),
65
+ rgba(0,229,255,0.05)
66
+ ) !important;
67
+ box-shadow: 0 0 18px rgba(0,229,255,0.25);
68
+ }
69
+
70
+ .gr-chatbot .message.bot {
71
+ background: rgba(255,255,255,0.06) !important;
72
+ box-shadow: 0 0 14px rgba(255,255,255,0.08);
73
+ }
74
+
75
+ .gr-textbox textarea {
76
+ background: rgba(255,255,255,0.04) !important;
77
+ color: #fff !important;
78
+ border: 1px solid rgba(255,255,255,0.15) !important;
79
+ border-radius: 12px !important;
80
+ padding: 12px !important;
81
+ resize: none !important;
82
+ }
83
+
84
+ .gr-textbox textarea:focus {
85
+ border-color: var(--accent) !important;
86
+ box-shadow: 0 0 12px rgba(0,229,255,0.4) !important;
87
+ }
88
+
89
+ .gr-button {
90
+ background: var(--accent) !important;
91
+ color: #000 !important;
92
+ border-radius: 10px !important;
93
+ font-weight: 600;
94
+ }
95
+
96
+ .gr-button:hover {
97
+ filter: brightness(1.1);
98
+ }
99
+
100
+ footer {
101
+ display: none !important;
102
+ }
103
  """
104
 
105
+ with gr.Blocks(css=css, fill_height=True) as demo:
106
+ gr.Markdown(
107
+ "<div style='text-align:center;letter-spacing:0.25em;opacity:0.7;margin-bottom:6px;'>DEVMEGABLACK</div>"
108
+ )
109
+ chatbot = gr.Chatbot(show_label=False)
110
+ with gr.Row():
111
+ msg = gr.Textbox(
112
+ placeholder="Type a message...",
113
+ scale=4
114
+ )
115
+ reset_btn = gr.Button("Reset", scale=1)
116
+
117
  msg.submit(respond, msg, chatbot)
118
  reset_btn.click(reset_chat, [], chatbot)
119