Sandeep09 commited on
Commit
9e1fb15
1 Parent(s): c9f34b1

Update 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
+ 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
+ st.markdown("<h1 style='text-align: center;'>Memeter 💬</h1>", unsafe_allow_html=True)
18
+ st.markdown("---")
19
+ with st.sidebar:
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)