meme / app.py
Akshay-More-007's picture
Update app.py
ad34727
raw
history blame contribute delete
945 Bytes
import streamlit as st
import requests
from io import BytesIO
from PIL import Image
import os
api_key = os.environ['API_KEY']
API_URL = "https://api-inference.huggingface.co/models/Hrishikesh332/autotrain-meme-classification-42897109437"
headers = {"Authorization": f"Bearer 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"}
def query(data : bytes):
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
st.markdown("<h1 style='text-align: center;'>Memeter 💬</h1>", unsafe_allow_html=True)
st.markdown("---")
with st.sidebar:
st.title("Memeter")
st.caption('''
Memeter is an application used for the classification of whether the images provided is meme or not meme
''', unsafe_allow_html=False)
img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
if img is not None:
data = img.read()
output = query(data)
st.write("Predicted Output:", output)