File size: 972 Bytes
3bdc2cd
 
 
 
 
ef9a2a1
 
 
 
 
ff2876e
ef9a2a1
 
 
 
 
 
 
46426cb
ef9a2a1
 
4c3570d
ef9a2a1
 
 
 
 
 
 
 
 
 
c154497
ef9a2a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

import streamlit as st
import requests
from io import BytesIO
from PIL import Image
import os

api_key = os.environ['API_KEY']

API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FHrishikesh332%2Fautotrain-meme-classification-42897109437%26quot%3B%3C%2Fspan%3E
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;'>Mememeter 💬</h1>", unsafe_allow_html=True)
st.markdown("---")
with st.sidebar:
    st.title("Mememeter")
    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.image(data)
        st.write("Predicted Output:", output)