Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,15 +73,68 @@
|
|
| 73 |
|
| 74 |
|
| 75 |
# app.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
import gradio as gr
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
gr.ChatInterface(
|
| 84 |
-
fn=
|
| 85 |
title="BubbleBot",
|
| 86 |
-
description="
|
|
|
|
|
|
|
| 87 |
).launch()
|
|
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
# app.py
|
| 76 |
+
#import gradio as gr
|
| 77 |
+
|
| 78 |
+
#def chat_fn(message, history):
|
| 79 |
+
# # history is a list of (user, bot) pairs
|
| 80 |
+
# response = f"🤖 You said: {message}"
|
| 81 |
+
# return response
|
| 82 |
+
#
|
| 83 |
+
#gr.ChatInterface(
|
| 84 |
+
# fn=chat_fn,
|
| 85 |
+
# title="BubbleBot",
|
| 86 |
+
# description="A friendly chatbot built with Gradio on Hugging Face Spaces."
|
| 87 |
+
#).launch()
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
#--==== Fancy bubbles ====
|
| 91 |
+
|
| 92 |
import gradio as gr
|
| 93 |
|
| 94 |
+
css = """
|
| 95 |
+
.gradio-container {
|
| 96 |
+
background: #f9fafb;
|
| 97 |
+
font-family: 'Inter', sans-serif;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.chatbot .user {
|
| 101 |
+
background: #dbeafe;
|
| 102 |
+
color: #1e3a8a;
|
| 103 |
+
border-radius: 16px;
|
| 104 |
+
padding: 8px 12px;
|
| 105 |
+
margin: 4px 0;
|
| 106 |
+
text-align: right;
|
| 107 |
+
max-width: 70%;
|
| 108 |
+
margin-left: auto;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.chatbot .bot {
|
| 112 |
+
background: #f3f4f6;
|
| 113 |
+
color: #111827;
|
| 114 |
+
border-radius: 16px;
|
| 115 |
+
padding: 8px 12px;
|
| 116 |
+
margin: 4px 0;
|
| 117 |
+
text-align: left;
|
| 118 |
+
max-width: 70%;
|
| 119 |
+
margin-right: auto;
|
| 120 |
+
}
|
| 121 |
+
"""
|
| 122 |
+
@keyframes typing {
|
| 123 |
+
0%, 100% { opacity: 0.4; transform: translateY(0); }
|
| 124 |
+
50% { opacity: 1; transform: translateY(-4px); }
|
| 125 |
+
}
|
| 126 |
+
.typing-dot {
|
| 127 |
+
animation: typing 1s infinite;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
def respond(message, history):
|
| 131 |
+
return f"BubbleBot says: {message}"
|
| 132 |
|
| 133 |
gr.ChatInterface(
|
| 134 |
+
fn=respond,
|
| 135 |
title="BubbleBot",
|
| 136 |
+
description="Stylish chat UI built with Gradio",
|
| 137 |
+
theme="soft",
|
| 138 |
+
css=css
|
| 139 |
).launch()
|
| 140 |
+
|