Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -88,5 +88,53 @@ def predict(message,history):
|
|
88 |
response = handle_query(message)
|
89 |
return response
|
90 |
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
response = handle_query(message)
|
89 |
return response
|
90 |
|
91 |
+
|
92 |
+
def custom_layout(component):
|
93 |
+
css = '''
|
94 |
+
/* Style the chat container */
|
95 |
+
.gradio-container {
|
96 |
+
display: flex;
|
97 |
+
flex-direction: column;
|
98 |
+
width: 400px;
|
99 |
+
margin: 0 auto;
|
100 |
+
padding: 20px;
|
101 |
+
border: 1px solid #ddd;
|
102 |
+
border-radius: 5px;
|
103 |
+
background-color: #eee;
|
104 |
+
}
|
105 |
+
|
106 |
+
/* Style the title */
|
107 |
+
.gradio-title {
|
108 |
+
text-align: center;
|
109 |
+
font-weight: bold;
|
110 |
+
margin-bottom: 10px;
|
111 |
+
}
|
112 |
+
|
113 |
+
/* Style the chat history */
|
114 |
+
.gradio-chat-history {
|
115 |
+
flex: 1;
|
116 |
+
overflow-y: scroll;
|
117 |
+
padding: 10px;
|
118 |
+
border-bottom: 1px solid #ddd;
|
119 |
+
}
|
120 |
+
|
121 |
+
/* Style the chat message */
|
122 |
+
.gradio-message {
|
123 |
+
margin-bottom: 5px;
|
124 |
+
}
|
125 |
+
|
126 |
+
/* Style the user input field */
|
127 |
+
.gradio-chat-input input {
|
128 |
+
width: 100%;
|
129 |
+
padding: 10px;
|
130 |
+
border: 1px solid #ccc;
|
131 |
+
border-radius: 3px;
|
132 |
+
font-size: 16px;
|
133 |
+
}
|
134 |
+
'''
|
135 |
+
return gr.components.HTML(css)(component)
|
136 |
+
|
137 |
+
# Launch the chat interface with custom layout
|
138 |
+
interface = gr.ChatInterface(predict, title="RedFerns Tech", layout=custom_layout)
|
139 |
+
interface.launch()
|
140 |
+
|