13ilguun commited on
Commit
b0c0d18
·
1 Parent(s): 76e6aeb

Add custom CSS styling for improved UI in chat interface

Browse files
Files changed (1) hide show
  1. app.py +81 -3
app.py CHANGED
@@ -29,11 +29,89 @@ def query_api(message):
29
  except Exception as e:
30
  return f"Error: {e}\n\nFull response:\n{response.text}"
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  demo = gr.Interface(
33
  fn=query_api,
34
- inputs=gr.Textbox(label="Ask something"),
35
- outputs="text",
36
- title="Chat with AI Co-Pilot (Llama 3.1)",
 
37
  )
38
 
39
  if __name__ == "__main__":
 
29
  except Exception as e:
30
  return f"Error: {e}\n\nFull response:\n{response.text}"
31
 
32
+ custom_css = """
33
+ @import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap');
34
+
35
+ :root {
36
+ --color-primary: #030712;
37
+ --color-accent: #2563eb;
38
+ --color-muted: #9ca3af;
39
+ --font-main: "Roboto Condensed", sans-serif;
40
+ }
41
+
42
+ body {
43
+ background-color: #030712;
44
+ color: white;
45
+ font-family: var(--font-main);
46
+ }
47
+
48
+ .gradio-container {
49
+ font-family: var(--font-main);
50
+ background-color: #030712;
51
+ color: white;
52
+ }
53
+
54
+ h1, h2, h3, h4, h5 {
55
+ font-weight: 600;
56
+ color: white;
57
+ font-family: var(--font-main);
58
+ }
59
+
60
+ .contain {
61
+ background-color: #030712 !important;
62
+ }
63
+
64
+ /* Input/Output boxes */
65
+ textarea, input {
66
+ background-color: #1f2937 !important;
67
+ color: white !important;
68
+ border: 1px solid #374151 !important;
69
+ border-radius: 0.5rem !important;
70
+ font-family: var(--font-main);
71
+ }
72
+
73
+ textarea:focus, input:focus {
74
+ outline: none !important;
75
+ border-color: #2563eb !important;
76
+ }
77
+
78
+ /* Buttons */
79
+ button {
80
+ background-color: #2563eb !important;
81
+ color: white !important;
82
+ font-weight: 600 !important;
83
+ border-radius: 0.5rem !important;
84
+ padding: 0.5rem 1rem !important;
85
+ font-family: var(--font-main);
86
+ transition: all 300ms !important;
87
+ }
88
+
89
+ button:hover {
90
+ background-color: #1d4ed8 !important;
91
+ }
92
+
93
+ /* Card-like containers */
94
+ .block {
95
+ background-color: #111827 !important;
96
+ border: 1px solid #1f2937 !important;
97
+ border-radius: 1rem !important;
98
+ padding: 1.5rem !important;
99
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3) !important;
100
+ }
101
+
102
+ label {
103
+ color: white !important;
104
+ font-weight: 600 !important;
105
+ font-family: var(--font-main);
106
+ }
107
+ """
108
+
109
  demo = gr.Interface(
110
  fn=query_api,
111
+ inputs=gr.Textbox(label="Ask something", placeholder="Type your message here..."),
112
+ outputs=gr.Textbox(label="Response", lines=10),
113
+ title="Chat with AI Co-Pilot",
114
+ css=custom_css
115
  )
116
 
117
  if __name__ == "__main__":