Spaces:
Runtime error
Runtime error
Commit
·
5d306d9
1
Parent(s):
6d8e22b
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,9 +9,9 @@ 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(
|
| 13 |
-
with open(filename, "rb") as f:
|
| 14 |
-
|
| 15 |
response = requests.post(API_URL, headers=headers, data=data)
|
| 16 |
return response.json()
|
| 17 |
|
|
@@ -36,8 +36,8 @@ img = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
|
|
| 36 |
|
| 37 |
if img is not None:
|
| 38 |
# image = Image.open(BytesIO(img.read()))
|
| 39 |
-
|
| 40 |
-
output = query(
|
| 41 |
st.write("Predicted Output:", output)
|
| 42 |
|
| 43 |
|
|
|
|
| 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 |
+
# with open(filename, "rb") as f:
|
| 14 |
+
# data = f.read()
|
| 15 |
response = requests.post(API_URL, headers=headers, data=data)
|
| 16 |
return response.json()
|
| 17 |
|
|
|
|
| 36 |
|
| 37 |
if img is not None:
|
| 38 |
# image = Image.open(BytesIO(img.read()))
|
| 39 |
+
data = img.read()
|
| 40 |
+
output = query(data)
|
| 41 |
st.write("Predicted Output:", output)
|
| 42 |
|
| 43 |
|