Prabhat2004 commited on
Commit
d9b99f0
·
1 Parent(s): ddce311

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -2
app.py CHANGED
@@ -1,3 +1,33 @@
1
- import gradio as gr
 
 
 
 
 
2
 
3
- gr.Interface.load("models/Hrishikesh332/autotrain-meme-classification-42897109437").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Loading the dependencies
2
+ import streamlit as st
3
+ import requests
4
+ from io import BytesIO
5
+ from PIL import Image
6
+ import os
7
 
8
+ api_key = os.environ['API_KEY']
9
+
10
+ API_URL = "https://api-inference.huggingface.co/models/Hrishikesh332/autotrain-meme-classification-42897109437"
11
+ headers = {"Authorization": f"Bearer {api_key}"}
12
+
13
+ def query(data : bytes):
14
+
15
+ response = requests.post(API_URL, headers=headers, data=data)
16
+ return response.json()
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("Memeter")
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
+
27
+ img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
28
+
29
+ if img is not None:
30
+
31
+ data = img.read()
32
+ output = query(data)
33
+ st.write("Predicted Output:", output)