Skip to content

Commit e18577f

Browse files
mikekgfbmalfet
authored andcommitted
add style sheet and logo to browser (#352)
* style sheet * update css
1 parent 226babe commit e18577f

File tree

3 files changed

+119
-11
lines changed

3 files changed

+119
-11
lines changed

chat_in_browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def chat():
5858
global convo
5959

6060
if _prompt:
61-
convo += "Your prompt:\n" + _prompt + "\n\n"
62-
convo += "My response:\n" + output + "\n\n"
61+
convo += "<H1>Your prompt</H1>\n<p> " + _prompt + " </p>\n\n"
62+
convo += "<H1>My response</H1>\n<p> " + output + " </p>\n\n"
6363

6464
return render_template("chat.html", convo=convo, disable_input=disable_input)
6565

static/css/style.css

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
body {
2+
font-family: "Helvetica Neue", Arial, sans-serif;
3+
background-color: #f5f5f5;
4+
color: #333;
5+
margin: 0;
6+
padding: 0;
7+
}
8+
9+
.main-content {
10+
width: 66%;
11+
padding: 20px;
12+
float: left; /* Add this line */
13+
}
14+
15+
.main-content h1 {
16+
font-family: "Helvetica Neue", Arial, sans-serif;
17+
font-size: 0.8em; /* Adjust as needed */
18+
color: rgba(208, 0, 0, 0.5); /* Semi-transparent PyTorch red */
19+
margin-left: 20px; /* Align with the left side of the text box */
20+
margin-bottom: 2pt; /* Adjust as needed */
21+
}
22+
23+
pre {
24+
background-color: #fff;
25+
border: 1px solid #ddd;
26+
border-radius: 5px;
27+
padding: 10px;
28+
margin: 20px;
29+
font-size: 16px;
30+
line-height: 1.6;
31+
overflow: auto;
32+
}
33+
34+
form {
35+
background-color: #fff;
36+
border: 1px solid #ddd;
37+
border-radius: 5px;
38+
padding: 20px;
39+
margin: 20px;
40+
}
41+
42+
label {
43+
font-weight: bold;
44+
color: #555;
45+
}
46+
47+
input[type="text"] {
48+
border: 1px solid #ddd;
49+
border-radius: 5px;
50+
padding: 10px;
51+
width: 100%;
52+
box-sizing: border-box;
53+
margin-bottom: 20px;
54+
}
55+
56+
input[type="submit"] {
57+
background-color: #D00000; /* PyTorch red */
58+
color: #fff;
59+
border: none;
60+
border-radius: 5px;
61+
padding: 10px 20px;
62+
cursor: pointer;
63+
text-transform: uppercase;
64+
}
65+
66+
input[type="submit"]:hover {
67+
background-color: #b30000;
68+
}
69+
70+
.logo-container {
71+
width: 33%;
72+
position: fixed;
73+
right: 0;
74+
text-align: center;
75+
padding: 20px;
76+
}
77+
78+
.logo {
79+
width: 100%;
80+
max-width: 300px; /* Adjust as needed */
81+
}
82+
83+
.chat-title {
84+
color: #D00000; /* PyTorch red */
85+
font-size: 3em; /* Adjust as needed */
86+
}
87+
88+
p {
89+
font-family: "Helvetica Neue", Arial, sans-serif;
90+
background-color: #fff;
91+
border: 1px solid #ddd;
92+
border-radius: 15px; /* Rounded edges */
93+
padding: 10px;
94+
margin: 20px;
95+
color: #D00000; /* PyTorch red */
96+
}

templates/chat.html

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<title>torchchat</title>
6-
</head>
7-
<body>
8-
<pre>{{ convo }}</pre>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>torchchat</title>
6+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
7+
</head>
8+
9+
<body>
10+
<div class="main-content">
11+
{{ convo | safe }}
912
<form action="chat" method="post">
1013
<label for="username">Prompt: </label>
11-
<input type="text" {{ 'disabled' if disable_input else '' }} id="prompt" name="prompt"><br>
14+
<input type="text" id="prompt" name="prompt"><br>
1215
<input type="submit" value="SEND">
1316
</form>
14-
</body>
15-
</html>
17+
</div>
18+
<div class="logo-container">
19+
<!--
20+
<img src="{{ url_for('static', filename='https://upload.wikimedia.org/wikipedia/commons/1/10/PyTorch_logo_icon.svg') }}" alt="PyTorch Logo" class="logo">
21+
-->
22+
<img src="https://upload.wikimedia.org/wikipedia/commons/1/10/PyTorch_logo_icon.svg" alt="PyTorch Logo" class="logo">
23+
<h1 class="chat-title">torchchat</h1>
24+
</div>
25+
26+
</body>
27+

0 commit comments

Comments
 (0)