Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ def chat_fn(message, history):
|
|
| 14 |
if isinstance(h, (list, tuple)):
|
| 15 |
if h[0]: messages.append({"role": "user", "content": str(h[0])})
|
| 16 |
if h[1]: messages.append({"role": "assistant", "content": str(h[1])})
|
|
|
|
| 17 |
messages.append({"role": "user", "content": str(message)})
|
| 18 |
response = ""
|
| 19 |
try:
|
|
@@ -27,74 +28,65 @@ def chat_fn(message, history):
|
|
| 27 |
|
| 28 |
# 2. Das "Clean & Ultra-Round" Design
|
| 29 |
custom_css = """
|
| 30 |
-
/* Hintergrund:
|
| 31 |
-
.gradio-container {
|
| 32 |
-
background-color: #f4f9ff !important;
|
| 33 |
-
}
|
| 34 |
|
| 35 |
-
/* Entfernt die
|
| 36 |
-
.gr-box
|
| 37 |
border: none !important;
|
| 38 |
-
background: transparent !important;
|
| 39 |
-
box-shadow: none !important;
|
| 40 |
}
|
| 41 |
|
| 42 |
-
/* Chat-Fenster:
|
| 43 |
.chatbot {
|
| 44 |
border-radius: 50px !important;
|
| 45 |
border: none !important;
|
| 46 |
background-color: #ffffff !important;
|
| 47 |
box-shadow: 0 8px 30px rgba(0,0,0,0.05) !important;
|
| 48 |
-
margin-bottom: 25px !important;
|
| 49 |
}
|
| 50 |
|
| 51 |
-
/* Textfarben
|
| 52 |
-
.chatbot p, .chatbot span {
|
| 53 |
color: #000000 !important;
|
| 54 |
}
|
| 55 |
|
| 56 |
-
/* Eingabefeld:
|
| 57 |
#input-box textarea {
|
| 58 |
border-radius: 50px !important;
|
| 59 |
border: 2px solid #3b82f6 !important;
|
| 60 |
padding: 15px 30px !important;
|
| 61 |
background-color: #ffffff !important;
|
| 62 |
color: #000000 !important;
|
| 63 |
-
font-size: 16px !important;
|
| 64 |
}
|
| 65 |
|
| 66 |
-
/*
|
| 67 |
-
#input-box textarea::placeholder {
|
| 68 |
-
color: #9ca3af !important;
|
| 69 |
-
}
|
| 70 |
|
| 71 |
-
/*
|
| 72 |
button.primary {
|
| 73 |
border-radius: 50px !important;
|
| 74 |
background-color: #3b82f6 !important;
|
| 75 |
color: white !important;
|
| 76 |
font-weight: bold !important;
|
| 77 |
-
border: none !important;
|
| 78 |
-
height: 50px !important;
|
| 79 |
}
|
| 80 |
|
|
|
|
| 81 |
footer { display: none !important; }
|
|
|
|
| 82 |
"""
|
| 83 |
|
| 84 |
with gr.Blocks(title="CocoAi Smooth") as demo:
|
| 85 |
-
# Header
|
| 86 |
with gr.Column():
|
| 87 |
gr.HTML("<div style='text-align: center; padding: 15px;'>")
|
| 88 |
gr.Markdown("# <span style='color: #1e40af; font-size: 36px;'>🐱 CocoAi</span>")
|
| 89 |
-
gr.Markdown("<p style='color: #000000; font-size: 18px;'>Intelligent • Loyal • CocoEntertainment</p>")
|
| 90 |
gr.HTML("</div>")
|
| 91 |
|
| 92 |
-
#
|
| 93 |
gr.ChatInterface(
|
| 94 |
fn=chat_fn,
|
| 95 |
submit_btn="Abschicken",
|
| 96 |
-
show_clear_button=False, # Korrekter Name für Gradio 6
|
| 97 |
-
show_stop_button=False,
|
| 98 |
textbox=gr.Textbox(
|
| 99 |
placeholder="Frag CocoAi etwas...",
|
| 100 |
container=False,
|
|
@@ -106,8 +98,5 @@ with gr.Blocks(title="CocoAi Smooth") as demo:
|
|
| 106 |
if __name__ == "__main__":
|
| 107 |
demo.launch(
|
| 108 |
css=custom_css,
|
| 109 |
-
theme=gr.themes.Soft(
|
| 110 |
-
primary_hue="blue",
|
| 111 |
-
radius_size="xxl"
|
| 112 |
-
)
|
| 113 |
)
|
|
|
|
| 14 |
if isinstance(h, (list, tuple)):
|
| 15 |
if h[0]: messages.append({"role": "user", "content": str(h[0])})
|
| 16 |
if h[1]: messages.append({"role": "assistant", "content": str(h[1])})
|
| 17 |
+
|
| 18 |
messages.append({"role": "user", "content": str(message)})
|
| 19 |
response = ""
|
| 20 |
try:
|
|
|
|
| 28 |
|
| 29 |
# 2. Das "Clean & Ultra-Round" Design
|
| 30 |
custom_css = """
|
| 31 |
+
/* Hintergrund: Cloud-Blau */
|
| 32 |
+
.gradio-container { background-color: #f4f9ff !important; }
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
/* Entfernt die doppelte Leiste/Box hinter dem Input */
|
| 35 |
+
.form, .gr-box {
|
| 36 |
border: none !important;
|
| 37 |
+
background: transparent !important;
|
| 38 |
+
box-shadow: none !important;
|
| 39 |
}
|
| 40 |
|
| 41 |
+
/* Chat-Fenster: Extra rund, weiß & heller Bereich */
|
| 42 |
.chatbot {
|
| 43 |
border-radius: 50px !important;
|
| 44 |
border: none !important;
|
| 45 |
background-color: #ffffff !important;
|
| 46 |
box-shadow: 0 8px 30px rgba(0,0,0,0.05) !important;
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
+
/* Textfarben: Echtes Tiefschwarz */
|
| 50 |
+
.chatbot p, .chatbot span, .chatbot div {
|
| 51 |
color: #000000 !important;
|
| 52 |
}
|
| 53 |
|
| 54 |
+
/* Eingabefeld: Pillen-Design */
|
| 55 |
#input-box textarea {
|
| 56 |
border-radius: 50px !important;
|
| 57 |
border: 2px solid #3b82f6 !important;
|
| 58 |
padding: 15px 30px !important;
|
| 59 |
background-color: #ffffff !important;
|
| 60 |
color: #000000 !important;
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
+
/* Platzhalter Text (Leicht grau) */
|
| 64 |
+
#input-box textarea::placeholder { color: #9ca3af !important; }
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
/* Abschickbutton: Rund & Blau */
|
| 67 |
button.primary {
|
| 68 |
border-radius: 50px !important;
|
| 69 |
background-color: #3b82f6 !important;
|
| 70 |
color: white !important;
|
| 71 |
font-weight: bold !important;
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
+
/* Verstecke alle ungewollten Gradio-Standard-Buttons über CSS */
|
| 75 |
footer { display: none !important; }
|
| 76 |
+
.clear-common { display: none !important; }
|
| 77 |
"""
|
| 78 |
|
| 79 |
with gr.Blocks(title="CocoAi Smooth") as demo:
|
|
|
|
| 80 |
with gr.Column():
|
| 81 |
gr.HTML("<div style='text-align: center; padding: 15px;'>")
|
| 82 |
gr.Markdown("# <span style='color: #1e40af; font-size: 36px;'>🐱 CocoAi</span>")
|
| 83 |
+
gr.Markdown("<p style='color: #000000; font-size: 18px; font-weight: bold;'>Intelligent • Loyal • CocoEntertainment</p>")
|
| 84 |
gr.HTML("</div>")
|
| 85 |
|
| 86 |
+
# Minimalistisches ChatInterface - Buttons werden via CSS ausgeblendet
|
| 87 |
gr.ChatInterface(
|
| 88 |
fn=chat_fn,
|
| 89 |
submit_btn="Abschicken",
|
|
|
|
|
|
|
| 90 |
textbox=gr.Textbox(
|
| 91 |
placeholder="Frag CocoAi etwas...",
|
| 92 |
container=False,
|
|
|
|
| 98 |
if __name__ == "__main__":
|
| 99 |
demo.launch(
|
| 100 |
css=custom_css,
|
| 101 |
+
theme=gr.themes.Soft(primary_hue="blue", radius_size="xxl")
|
|
|
|
|
|
|
|
|
|
| 102 |
)
|