abhigyanbafna commited on
Commit
9fda4f8
1 Parent(s): 4bedbc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -2
app.py CHANGED
@@ -1,3 +1,32 @@
1
- import gradio as gr
 
 
 
 
2
 
3
- gr.Interface.load("models/Hrishikesh332/autotrain-meme-classification-42897109437").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ from io import BytesIO
4
+ from PIL import Image
5
+ import os
6
 
7
+ api_key = os.environ['API_KEY']
8
+
9
+ API_URL = "https://api-inference.huggingface.co/models/Hrishikesh332/autotrain-meme-classification-42897109437"
10
+ headers = {"Authorization": f"Bearer {api_key}"}
11
+
12
+ def query(data : bytes):
13
+
14
+ response = requests.post(API_URL, headers=headers, data=data)
15
+ return response.json()
16
+
17
+
18
+ st.markdown("<h1 style='text-align: center;'>Memeter 💬</h1>", unsafe_allow_html=True)
19
+ st.markdown("---")
20
+ with st.sidebar:
21
+ st.title("Memometer")
22
+ st.caption('''
23
+ Memeter is an application used for the classification of whether the images provided is meme or not meme
24
+ ''', unsafe_allow_html=False)
25
+
26
+ img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
27
+
28
+ if img is not None:
29
+
30
+ data = img.read()
31
+ output = query(data)
32
+ st.write("Predicted Output:", output)