Spaces:
Sleeping
Sleeping
bhavyagiri
commited on
Commit
·
a06fc9a
1
Parent(s):
014e1e5
Upload app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,8 @@ from huggingface_hub import hf_hub_download
|
|
3 |
import os
|
4 |
import pickle
|
5 |
import pandas as pd
|
|
|
|
|
6 |
import gradio as gr
|
7 |
|
8 |
pd.options.mode.chained_assignment = None # Turn off SettingWithCopyWarning
|
@@ -19,7 +21,7 @@ def generate_memes(prompt):
|
|
19 |
desired_ids = hits["corpus_id"]
|
20 |
filtered_df = df.loc[df['id'].isin(desired_ids)]
|
21 |
filtered_list = list(filtered_df["url"])
|
22 |
-
images = [
|
23 |
return (
|
24 |
images
|
25 |
)
|
|
|
3 |
import os
|
4 |
import pickle
|
5 |
import pandas as pd
|
6 |
+
import urllib.request
|
7 |
+
from PIL import Image
|
8 |
import gradio as gr
|
9 |
|
10 |
pd.options.mode.chained_assignment = None # Turn off SettingWithCopyWarning
|
|
|
21 |
desired_ids = hits["corpus_id"]
|
22 |
filtered_df = df.loc[df['id'].isin(desired_ids)]
|
23 |
filtered_list = list(filtered_df["url"])
|
24 |
+
images = [Image.open(urllib.request.urlretrieve(img)) for img in filtered_list]
|
25 |
return (
|
26 |
images
|
27 |
)
|