CoolFace
Apppublic

Sandeep09/meme_classifier

sourceHugging Faceopenrailupdated 4y agoView on Hugging Face
0likes
app.py32 linesDownload Raw Back to root
1import streamlit as st2import requests3from io import BytesIO4from PIL import Image5import os6 7api_key = os.environ['API_KEY']8 9API_URL = "https://api-inference.huggingface.co/models/Hrishikesh332/autotrain-meme-classification-42897109437"10headers = {"Authorization": f"Bearer {api_key}"}11 12def query(data : bytes):13 14    response = requests.post(API_URL, headers=headers, data=data)15    return response.json()16 17st.markdown("<h1 style='text-align: center;'>Memeter 💬</h1>", unsafe_allow_html=True)18st.markdown("---")19with st.sidebar:20    st.title("Memometer")21    st.caption('''22    Memeter is an application used for the classification of whether the images provided is meme or not meme23    ''', unsafe_allow_html=False)24 25img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])26 27if img is not None:28 29        data = img.read()30        st.image(data)31        output = query(data)32        st.write("Predicted Output:", output)