Spaces:
Running
Running
update output box background
Browse files
app.py
CHANGED
@@ -21,12 +21,11 @@ except Exception as e:
|
|
21 |
model_loaded = False
|
22 |
print(f"Error loading model: {e}")
|
23 |
|
24 |
-
# --- Core CONVERSATIONAL Logic (No changes
|
25 |
@spaces.GPU()
|
26 |
def handle_conversation_turn(user_input: str, user_image: Image.Image, history: list):
|
27 |
"""
|
28 |
Manages a single conversation turn and streams the AI response back.
|
29 |
-
This function is a Python generator.
|
30 |
"""
|
31 |
if not model_loaded:
|
32 |
history[-1] = (user_input, "Error: The AI model is not loaded.")
|
@@ -73,11 +72,11 @@ def handle_conversation_turn(user_input: str, user_image: Image.Image, history:
|
|
73 |
print(f"An exception occurred during conversation turn: {type(e).__name__}: {e}")
|
74 |
yield history, history
|
75 |
|
76 |
-
# --- UI MODIFICATION:
|
77 |
css = """
|
78 |
-
/* Main App Styling
|
79 |
-
|
80 |
-
#chat-container { flex-grow: 1; overflow-y: auto; padding-bottom: 200px !important; }
|
81 |
/* Chat Bubble Styling */
|
82 |
.user > .message-bubble-row .message-bubble { background-color: #dbeafe !important; color: #1f2937 !important; border-top-right-radius: 5px !important; }
|
83 |
.bot > .message-bubble-row .message-bubble { background-color: #f3f4f6 !important; color: #1f2937 !important; border-top-left-radius: 5px !important; }
|
|
|
21 |
model_loaded = False
|
22 |
print(f"Error loading model: {e}")
|
23 |
|
24 |
+
# --- Core CONVERSATIONAL Logic (No changes) ---
|
25 |
@spaces.GPU()
|
26 |
def handle_conversation_turn(user_input: str, user_image: Image.Image, history: list):
|
27 |
"""
|
28 |
Manages a single conversation turn and streams the AI response back.
|
|
|
29 |
"""
|
30 |
if not model_loaded:
|
31 |
history[-1] = (user_input, "Error: The AI model is not loaded.")
|
|
|
72 |
print(f"An exception occurred during conversation turn: {type(e).__name__}: {e}")
|
73 |
yield history, history
|
74 |
|
75 |
+
# --- UI MODIFICATION: Final CSS for a white background and professional look ---
|
76 |
css = """
|
77 |
+
/* Main App Styling */
|
78 |
+
gradio-app { background-color: #ffffff !important; }
|
79 |
+
#chat-container { background: transparent; flex-grow: 1; overflow-y: auto; padding-bottom: 200px !important; }
|
80 |
/* Chat Bubble Styling */
|
81 |
.user > .message-bubble-row .message-bubble { background-color: #dbeafe !important; color: #1f2937 !important; border-top-right-radius: 5px !important; }
|
82 |
.bot > .message-bubble-row .message-bubble { background-color: #f3f4f6 !important; color: #1f2937 !important; border-top-left-radius: 5px !important; }
|