Spaces:
Sleeping
Sleeping
Commit ·
56732d1
1
Parent(s): 4458d42
Initial Commit
Browse files4 unmodified lines567891038 unmodified lines495051525354555657585960616263646566676811 unmodified lines808182838485868788899091924 unmodified linesimport osfrom gradio_client import Client# Hugging Face API keyAPI_KEY = st.secrets["HF_API_KEY"]38 unmodified linesst.title("Food Image Recognition with Ingredients")# Add banner imagest.image("IR_IMAGE.png", caption="Food Recognition Model", use_container_width=True)# Sidebar for model informationst.sidebar.title("Model Information")st.sidebar.write("**Image Classification Model**: Shresthadev403/food-image-classification")st.sidebar.write("**LLM for Ingredients**: Qwen/Qwen2.5-Coder-32B-Instruct")# Upload imageuploaded_file = st.file_uploader("Choose a food image...", type=["jpg", "png", "jpeg"])if uploaded_file is not None:# Display the uploaded imageimage = Image.open(uploaded_file)st.image(image, caption="Uploaded Image", use_container_width=True)st.write("Classifying...")# Make predictions11 unmodified linesexcept Exception as e:st.error(f"Error generating ingredients: {e}")st.subheader("Healthier alternatives:")try:client = Client("https://8a56cb969da1f9d721.gradio.live/")result = client.predict(query=f"What's a healthy {top_food} recipe, and why is it healthy?", api_name="/get_response")st.write(result)except Exception as e:st.error(f"Unable to contact RAG: {e}")# Footerst.sidebar.markdown("Developed by Muhammad Hassan Butt.")4 unmodified lines567891011121314151617181920212223242538 unmodified lines646566676869707172737475767778798081828384858611 unmodified lines98991001011021031041051061071081091104 unmodified linesimport osfrom gradio_client import Client# Set page configurationst.set_page_config(page_title="Food Image Recognition with Ingredients",page_icon="🍔",layout="wide",initial_sidebar_state="expanded",)# Custom CSS to improve styling and responsivenessdef local_css(file_name):with open(file_name) as f:st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)local_css("style.css")# Hugging Face API keyAPI_KEY = st.secrets["HF_API_KEY"]38 unmodified linesst.title("Food Image Recognition with Ingredients")# Add banner imagest.image("IR_IMAGE.png", caption="Food Recognition Model", use_column_width=True)# Sidebar for model informationwith st.sidebar:st.title("Model Information")st.write("**Image Classification Model**: Shresthadev403/food-image-classification")st.write("**LLM for Ingredients**: Qwen/Qwen2.5-Coder-32B-Instruct")st.markdown("---")st.markdown("<p style='text-align: center;'>Developed by Muhammad Hassan Butt.</p>", unsafe_allow_html=True)# Main contentuploaded_file = st.file_uploader("Choose a food image...", type=["jpg", "png", "jpeg"])if uploaded_file is not None:# Display the uploaded imageimage = Image.open(uploaded_file)st.image(image, caption="Uploaded Image", use_column_width=True)st.write("Classifying...")# Make predictions11 unmodified linesexcept Exception as e:st.error(f"Error generating ingredients: {e}")st.subheader("Healthier Alternatives")try:client_gradio = Client("https://8a56cb969da1f9d721.gradio.live/")result = client_gradio.predict(query=f"What's a healthy {top_food} recipe, and why is it healthy?",api_name="/get_response")st.write(result)except Exception as e:st.error(f"Unable to contact RAG: {e}")
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374/* General settings */body { background-color: #f5f5f5;}
/* Title styling */h1 { text-align: center; color: #333333; font-size: 2.5rem; margin-bottom: 20px;}
/* Image styling */.st-image > img { border-radius: 10px; margin-bottom: 20px;}
/* Sidebar styling */.css-1d391kg { background-color: #ffffff; border-right: 1px solid #e6e6e6;}
.stSidebar > div { padding: 20px;}
/* Text elements */h2 { color: #4285F4; margin-top: 30px;}
h3 { color: #333333;}
/* File uploader styling */.css-1cpxqw2 { background-color: #4285F4; color: #ffffff; border: none; border-radius: 5px;}
.css-1cpxqw2:hover { background-color: #357ae8; color: #ffffff;}
/* Footer styling */footer { visibility: hidden;}
/* Adjustments for mobile devices */@media only screen and (max-width: 600px) { /* Adjust title size */ h1 { font-size: 2rem; }
/* Adjust image size */ .st-image > img { width: 100%; }
/* Sidebar adjustments */ .css-1d391kg { width: 100%; }}app.py+30-12
style.cssAdded+74