aniket23 commited on
Commit
51db937
1 Parent(s): abc4a1d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -2
app.py CHANGED
@@ -1,3 +1,31 @@
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
+ 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
+ st.markdown("<h1 style='text-align: center;'>Memeter 💬</h1>", unsafe_allow_html=True)
18
+ st.markdown("---")
19
+ with st.sidebar: #To create a side bar
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 meme
23
+ ''', unsafe_allow_html=False)
24
+
25
+ img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
26
+
27
+ if img is not None:
28
+
29
+ data = img.read()
30
+ output = query(data)
31
+ st.write("Predicted Output:", output)