Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ import pickle
|
|
6 |
import numpy as np
|
7 |
import torch.nn.functional as F
|
8 |
from accelerate import init_empty_weights, infer_auto_device_map, load_checkpoint_and_dispatch
|
9 |
-
import gradio as gr
|
10 |
|
11 |
# ---- Constants and Setup ----
|
12 |
model_name = 'gpt2'
|
@@ -89,73 +88,35 @@ def advanced_agi_chat(user_input):
|
|
89 |
# ---- Gradio Interface ----
|
90 |
def chat_interface(user_input):
|
91 |
response = advanced_agi_chat(user_input)
|
92 |
-
|
93 |
-
return [(user_input, "user"), (response, "ai")]
|
94 |
|
95 |
# ---- Gradio App Setup ----
|
|
|
|
|
96 |
auth = ("Tej", "186281mps", "ACC", "HIPE")
|
97 |
|
98 |
with gr.Blocks() as app:
|
99 |
gr.Markdown("# **Autistic Assistant vß Edition 2024 Ultra: Gertrude's Autistic Experience**")
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
gr.HTML("""
|
108 |
<style>
|
109 |
.gradio-container {
|
110 |
-
background-color: #
|
111 |
padding: 20px;
|
112 |
-
border-radius:
|
113 |
-
font-family: '
|
114 |
-
height: 600px;
|
115 |
}
|
116 |
-
.
|
117 |
-
background-color: white;
|
118 |
-
border-radius: 10px;
|
119 |
-
padding: 15px;
|
120 |
-
max-height: 400px;
|
121 |
-
overflow-y: auto;
|
122 |
display: flex;
|
123 |
-
|
124 |
-
gap: 15px;
|
125 |
-
}
|
126 |
-
.gr-chatbot .message {
|
127 |
-
border-radius: 20px;
|
128 |
-
padding: 12px;
|
129 |
-
max-width: 75%;
|
130 |
-
word-wrap: break-word;
|
131 |
-
font-size: 16px;
|
132 |
-
line-height: 1.4;
|
133 |
-
}
|
134 |
-
.gr-chatbot .message.user {
|
135 |
-
background-color: #007AFF; /* iPhone blue */
|
136 |
-
color: white;
|
137 |
-
align-self: flex-start;
|
138 |
-
margin-left: 15px;
|
139 |
-
border-top-right-radius: 0px; /* Make top right corner flat */
|
140 |
-
font-weight: 500;
|
141 |
-
}
|
142 |
-
.gr-chatbot .message.ai {
|
143 |
-
background-color: #F0F0F5; /* Light gray for assistant */
|
144 |
-
align-self: flex-end;
|
145 |
-
margin-right: 15px;
|
146 |
-
border-top-left-radius: 0px; /* Make top left corner flat */
|
147 |
-
font-weight: 400;
|
148 |
-
}
|
149 |
-
/* Scroll styling */
|
150 |
-
.gr-chatbot::-webkit-scrollbar {
|
151 |
-
width: 8px;
|
152 |
-
}
|
153 |
-
.gr-chatbot::-webkit-scrollbar-thumb {
|
154 |
-
background-color: #888;
|
155 |
-
border-radius: 10px;
|
156 |
-
}
|
157 |
-
.gr-chatbot::-webkit-scrollbar-thumb:hover {
|
158 |
-
background-color: #555;
|
159 |
}
|
160 |
</style>
|
161 |
""")
|
@@ -165,3 +126,4 @@ with gr.Blocks() as app:
|
|
165 |
|
166 |
# Launch the Gradio app
|
167 |
app.launch()
|
|
|
|
6 |
import numpy as np
|
7 |
import torch.nn.functional as F
|
8 |
from accelerate import init_empty_weights, infer_auto_device_map, load_checkpoint_and_dispatch
|
|
|
9 |
|
10 |
# ---- Constants and Setup ----
|
11 |
model_name = 'gpt2'
|
|
|
88 |
# ---- Gradio Interface ----
|
89 |
def chat_interface(user_input):
|
90 |
response = advanced_agi_chat(user_input)
|
91 |
+
return response
|
|
|
92 |
|
93 |
# ---- Gradio App Setup ----
|
94 |
+
import gradio as gr
|
95 |
+
|
96 |
auth = ("Tej", "186281mps", "ACC", "HIPE")
|
97 |
|
98 |
with gr.Blocks() as app:
|
99 |
gr.Markdown("# **Autistic Assistant vß Edition 2024 Ultra: Gertrude's Autistic Experience**")
|
100 |
|
101 |
+
with gr.Row():
|
102 |
+
with gr.Column(scale=1):
|
103 |
+
user_input = gr.Textbox(label="What will you say to Gertrude?", placeholder="Type something here...")
|
104 |
+
submit_button = gr.Button("Send")
|
105 |
+
with gr.Column(scale=1):
|
106 |
+
chatbot = gr.Textbox(label="Gertrude's Response", interactive=False) # This is now a Textbox for output
|
107 |
+
|
108 |
+
# Adding custom styling for the UI
|
109 |
gr.HTML("""
|
110 |
<style>
|
111 |
.gradio-container {
|
112 |
+
background-color: #B3D9FF;
|
113 |
padding: 20px;
|
114 |
+
border-radius: 15px;
|
115 |
+
font-family: 'Comic Sans MS';
|
|
|
116 |
}
|
117 |
+
.gradio-row {
|
|
|
|
|
|
|
|
|
|
|
118 |
display: flex;
|
119 |
+
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
</style>
|
122 |
""")
|
|
|
126 |
|
127 |
# Launch the Gradio app
|
128 |
app.launch()
|
129 |
+
|