Spaces:
Running
Running
Update app.py
Browse filesadd youtube links
app.py
CHANGED
|
@@ -90,8 +90,12 @@ def query_memes(user_input: str):
|
|
| 90 |
raw_url = meme.link
|
| 91 |
description = meme.description
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
embed_html = f'''
|
| 96 |
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); margin-top: 1em;">
|
| 97 |
<iframe src="{embed_url}"
|
|
@@ -100,7 +104,6 @@ def query_memes(user_input: str):
|
|
| 100 |
</iframe>
|
| 101 |
</div>
|
| 102 |
'''
|
| 103 |
-
|
| 104 |
return embed_html, description
|
| 105 |
|
| 106 |
|
|
|
|
| 90 |
raw_url = meme.link
|
| 91 |
description = meme.description
|
| 92 |
|
| 93 |
+
if "drive.google" in raw_url:
|
| 94 |
+
file_id = raw_url.split("/file/d/")[1].split("/")[0]
|
| 95 |
+
embed_url = f"https://drive.google.com/file/d/{file_id}/preview"
|
| 96 |
+
else:
|
| 97 |
+
embed_url = raw_url
|
| 98 |
+
|
| 99 |
embed_html = f'''
|
| 100 |
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); margin-top: 1em;">
|
| 101 |
<iframe src="{embed_url}"
|
|
|
|
| 104 |
</iframe>
|
| 105 |
</div>
|
| 106 |
'''
|
|
|
|
| 107 |
return embed_html, description
|
| 108 |
|
| 109 |
|