Spaces:
Sleeping
Sleeping
LuckyHappyFish
commited on
Commit
·
cf48067
1
Parent(s):
765f053
Im strugglign
Browse files
app.py
CHANGED
@@ -13,33 +13,116 @@ st.set_page_config(
|
|
13 |
initial_sidebar_state="expanded",
|
14 |
)
|
15 |
|
16 |
-
import streamlit as st
|
17 |
-
from transformers import pipeline
|
18 |
-
from PIL import Image
|
19 |
-
from huggingface_hub import InferenceClient
|
20 |
-
import os
|
21 |
-
from gradio_client import Client
|
22 |
-
|
23 |
-
# Set page configuration
|
24 |
-
st.set_page_config(
|
25 |
-
page_title="DelishAI - Your Culinary Assistant",
|
26 |
-
page_icon="🍽️",
|
27 |
-
layout="centered",
|
28 |
-
initial_sidebar_state="expanded",
|
29 |
-
)
|
30 |
-
|
31 |
-
# Updated CSS function
|
32 |
def local_css():
|
33 |
st.markdown(
|
34 |
"""
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
# Hugging Face API key
|
45 |
API_KEY = st.secrets["HF_API_KEY"]
|
|
|
13 |
initial_sidebar_state="expanded",
|
14 |
)
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def local_css():
|
17 |
st.markdown(
|
18 |
"""
|
19 |
+
<style>
|
20 |
+
/* Main layout */
|
21 |
+
.main { background-color: #f5f7fa; }
|
22 |
+
|
23 |
+
/* Title styling */
|
24 |
+
.title h1 {
|
25 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
26 |
+
text-align: center;
|
27 |
+
color: #007ACC; /* Changed to blue */
|
28 |
+
font-size: 3rem;
|
29 |
+
margin-bottom: 20px;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Image styling */
|
33 |
+
.st-image img {
|
34 |
+
border-radius: 15px;
|
35 |
+
margin-bottom: 20px;
|
36 |
+
max-width: 100%;
|
37 |
+
}
|
38 |
+
|
39 |
+
/* Sidebar styling */
|
40 |
+
[data-testid="stSidebar"] {
|
41 |
+
background-color: #ffffff; /* Changed to white */
|
42 |
+
border-right: 1px solid #e6e6e6;
|
43 |
+
}
|
44 |
+
[data-testid="stSidebar"] .css-ng1t4o { color: #333333; }
|
45 |
+
[data-testid="stSidebar"] .css-1d391kg { color: #333333; }
|
46 |
+
|
47 |
+
/* File uploader styling */
|
48 |
+
.stFileUploader {
|
49 |
+
border: 2px dashed #007ACC; /* Changed to blue */
|
50 |
+
border-radius: 10px;
|
51 |
+
padding: 20px;
|
52 |
+
text-align: center;
|
53 |
+
color: #007ACC; /* Changed to blue */
|
54 |
+
background-color: #ffffff;
|
55 |
+
font-weight: bold;
|
56 |
+
}
|
57 |
+
|
58 |
+
/* File uploader hover effect */
|
59 |
+
.stFileUploader:hover {
|
60 |
+
background-color: #e6f2ff; /* Light blue hover effect */
|
61 |
+
}
|
62 |
|
63 |
+
/* Button styling */
|
64 |
+
.stButton>button {
|
65 |
+
background-color: #007ACC; /* Changed to blue */
|
66 |
+
color: white;
|
67 |
+
border: none;
|
68 |
+
padding: 0.7rem 1.5rem;
|
69 |
+
border-radius: 5px;
|
70 |
+
font-size: 1.1rem;
|
71 |
+
font-weight: bold;
|
72 |
+
margin-top: 10px;
|
73 |
+
cursor: pointer;
|
74 |
+
}
|
75 |
+
.stButton>button:hover {
|
76 |
+
background-color: #005a99; /* Darker blue on hover */
|
77 |
+
color: white;
|
78 |
+
}
|
79 |
|
80 |
+
/* Headers styling */
|
81 |
+
h2 {
|
82 |
+
color: #007ACC; /* Changed to blue */
|
83 |
+
margin-top: 30px;
|
84 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
85 |
+
}
|
86 |
+
h3 {
|
87 |
+
color: #007ACC; /* Changed to blue */
|
88 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
89 |
+
}
|
90 |
|
91 |
+
/* Text styling */
|
92 |
+
.stMarkdown p { font-size: 1.1rem; color: #333333; }
|
93 |
+
|
94 |
+
/* Footer styling */
|
95 |
+
footer { visibility: hidden; }
|
96 |
+
|
97 |
+
/* Hide sidebar on small screens */
|
98 |
+
@media only screen and (max-width: 600px) {
|
99 |
+
[data-testid="stSidebar"] { display: none; }
|
100 |
+
.main .block-container { padding-left: 1rem; padding-right: 1rem; }
|
101 |
+
.title h1 { font-size: 2rem; }
|
102 |
+
.stButton>button { width: 100%; }
|
103 |
+
}
|
104 |
+
|
105 |
+
/* Sample images grid */
|
106 |
+
.sample-images {
|
107 |
+
display: flex;
|
108 |
+
justify-content: center;
|
109 |
+
flex-wrap: wrap;
|
110 |
+
gap: 10px;
|
111 |
+
}
|
112 |
+
.sample-images img {
|
113 |
+
width: 150px;
|
114 |
+
height: 150px;
|
115 |
+
object-fit: cover;
|
116 |
+
border-radius: 10px;
|
117 |
+
cursor: pointer;
|
118 |
+
border: 2px solid transparent;
|
119 |
+
}
|
120 |
+
.sample-images img:hover {
|
121 |
+
border: 2px solid #007ACC; /* Changed to blue */
|
122 |
+
}
|
123 |
+
</style>
|
124 |
+
""", unsafe_allow_html=True
|
125 |
+
)
|
126 |
|
127 |
# Hugging Face API key
|
128 |
API_KEY = st.secrets["HF_API_KEY"]
|