Spaces:
Sleeping
Sleeping
Commit
·
765f053
1
Parent(s):
df033c3
Im strugglign
Browse files
app.py
CHANGED
|
@@ -13,111 +13,34 @@ st.set_page_config(
|
|
| 13 |
initial_sidebar_state="expanded",
|
| 14 |
)
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def local_css():
|
| 18 |
st.markdown(
|
| 19 |
"""
|
| 20 |
-
|
| 21 |
-
/* Main layout */
|
| 22 |
-
.main { background-color: #f0f2f6; }
|
| 23 |
-
|
| 24 |
-
/* Title styling */
|
| 25 |
-
.title h1 {
|
| 26 |
-
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 27 |
-
text-align: center;
|
| 28 |
-
color: #ff4b4b;
|
| 29 |
-
font-size: 3rem;
|
| 30 |
-
margin-bottom: 20px;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
/* Image styling */
|
| 34 |
-
.st-image img {
|
| 35 |
-
border-radius: 15px;
|
| 36 |
-
margin-bottom: 20px;
|
| 37 |
-
max-width: 100%;
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
/* Sidebar styling */
|
| 41 |
-
[data-testid="stSidebar"] {
|
| 42 |
-
background-color: #ff4b4b;
|
| 43 |
-
}
|
| 44 |
-
[data-testid="stSidebar"] .css-ng1t4o { color: white; }
|
| 45 |
-
[data-testid="stSidebar"] .css-1d391kg { color: white; }
|
| 46 |
-
|
| 47 |
-
/* File uploader styling */
|
| 48 |
-
.stFileUploader {
|
| 49 |
-
border: 2px dashed #ff4b4b;
|
| 50 |
-
border-radius: 10px;
|
| 51 |
-
padding: 20px;
|
| 52 |
-
text-align: center;
|
| 53 |
-
color: #ff4b4b;
|
| 54 |
-
background-color: #ffffff;
|
| 55 |
-
font-weight: bold;
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
/* File uploader hover effect */
|
| 59 |
-
.stFileUploader:hover {
|
| 60 |
-
background-color: #ffe5e5;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/* Button styling */
|
| 64 |
-
.stButton>button {
|
| 65 |
-
background-color: #ff4b4b;
|
| 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 |
-
}
|
| 74 |
-
.stButton>button:hover {
|
| 75 |
-
background-color: #e04343;
|
| 76 |
-
color: white;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/* Headers styling */
|
| 80 |
-
h2 { color: #ff4b4b; margin-top: 30px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
|
| 81 |
-
h3 { color: #ff4b4b; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
|
| 82 |
-
|
| 83 |
-
/* Text styling */
|
| 84 |
-
.stMarkdown p { font-size: 1.1rem; }
|
| 85 |
-
|
| 86 |
-
/* Footer styling */
|
| 87 |
-
footer { visibility: hidden; }
|
| 88 |
-
|
| 89 |
-
/* Hide sidebar on small screens */
|
| 90 |
-
@media only screen and (max-width: 600px) {
|
| 91 |
-
[data-testid="stSidebar"] { display: none; }
|
| 92 |
-
.main .block-container { padding-left: 1rem; padding-right: 1rem; }
|
| 93 |
-
.title h1 { font-size: 2rem; }
|
| 94 |
-
.stButton>button { width: 100%; }
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/* Sample images grid */
|
| 98 |
-
.sample-images {
|
| 99 |
-
display: flex;
|
| 100 |
-
justify-content: center;
|
| 101 |
-
flex-wrap: wrap;
|
| 102 |
-
gap: 10px;
|
| 103 |
-
}
|
| 104 |
-
.sample-images img {
|
| 105 |
-
width: 150px;
|
| 106 |
-
height: 150px;
|
| 107 |
-
object-fit: cover;
|
| 108 |
-
border-radius: 10px;
|
| 109 |
-
cursor: pointer;
|
| 110 |
-
border: 2px solid transparent;
|
| 111 |
-
}
|
| 112 |
-
.sample-images img:hover {
|
| 113 |
-
border: 2px solid #ff4b4b;
|
| 114 |
-
}
|
| 115 |
-
</style>
|
| 116 |
""", unsafe_allow_html=True
|
| 117 |
)
|
| 118 |
|
| 119 |
local_css()
|
| 120 |
|
|
|
|
|
|
|
|
|
|
| 121 |
# Hugging Face API key
|
| 122 |
API_KEY = st.secrets["HF_API_KEY"]
|
| 123 |
|
|
|
|
| 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 |
+
<!-- [Insert the updated CSS code here] -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
""", unsafe_allow_html=True
|
| 37 |
)
|
| 38 |
|
| 39 |
local_css()
|
| 40 |
|
| 41 |
+
# Rest of your code remains the same...
|
| 42 |
+
|
| 43 |
+
|
| 44 |
# Hugging Face API key
|
| 45 |
API_KEY = st.secrets["HF_API_KEY"]
|
| 46 |
|