harvesthealth commited on
Commit
13e8407
·
verified ·
1 Parent(s): c071af2

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -27,7 +27,7 @@ COPY . .
27
 
28
  # Create a non-root user and media directories
29
  RUN useradd -m appuser && \
30
- mkdir -p /app/audios /app/videos /app/images && \
31
  chown -R appuser:appuser /app
32
  USER appuser
33
 
 
27
 
28
  # Create a non-root user and media directories
29
  RUN useradd -m appuser && \
30
+ mkdir -p /app/audios /app/videos /app/images /app/profile_images && \
31
  chown -R appuser:appuser /app
32
  USER appuser
33
 
socials/add_post_page.png ADDED
socials/add_post_page_full.png ADDED
socials/base/urls.py CHANGED
@@ -1,6 +1,7 @@
1
- from django.urls import path
2
  from django.conf import settings
3
  from django.conf.urls.static import static
 
4
  from .views import AddPostView,EditProfilePageView,CreateProfilePageView,PasswordsChangeView,FriendView,AddCommentView,DeletePostView,UpdatePostView,ShowProfilePageView
5
  from . import views
6
  from django.contrib.auth import views as auth_views
@@ -25,7 +26,11 @@ urlpatterns = [
25
  path('follow',views.follow,name='follow'),
26
  path('health', views.health_check, name='health'),
27
  path('api/posts', views.api_posts, name='api_posts'),
28
- ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 
 
 
 
29
 
30
 
31
 
 
1
+ from django.urls import path, re_path
2
  from django.conf import settings
3
  from django.conf.urls.static import static
4
+ from django.views.static import serve
5
  from .views import AddPostView,EditProfilePageView,CreateProfilePageView,PasswordsChangeView,FriendView,AddCommentView,DeletePostView,UpdatePostView,ShowProfilePageView
6
  from . import views
7
  from django.contrib.auth import views as auth_views
 
26
  path('follow',views.follow,name='follow'),
27
  path('health', views.health_check, name='health'),
28
  path('api/posts', views.api_posts, name='api_posts'),
29
+ re_path(r'^media/audios/(?P<path>.*)$', serve, {'document_root': '/app/audios'}),
30
+ re_path(r'^media/videos/(?P<path>.*)$', serve, {'document_root': '/app/videos'}),
31
+ re_path(r'^media/images/(?P<path>.*)$', serve, {'document_root': '/app/images'}),
32
+ re_path(r'^media/profile_images/(?P<path>.*)$', serve, {'document_root': '/app/profile_images'}),
33
+ ]
34
 
35
 
36
 
socials/home_page_final.png ADDED
verify_live_media.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from playwright.sync_api import sync_playwright
2
+ import time
3
+ import requests
4
+
5
+ def run():
6
+ with sync_playwright() as p:
7
+ browser = p.chromium.launch()
8
+ page = browser.new_page()
9
+
10
+ # Login
11
+ print("Logging in...")
12
+ page.goto("https://harvesthealth-dashboards-plotly.hf.space/login/")
13
+ page.fill('input[name="username"]', "admin")
14
+ page.fill('input[name="password"]', "admin123")
15
+ page.click('button:has-text("Sign In")')
16
+ page.wait_for_url("https://harvesthealth-dashboards-plotly.hf.space/")
17
+
18
+ # Add Post
19
+ print("Adding post with media...")
20
+ page.goto("https://harvesthealth-dashboards-plotly.hf.space/add_post/")
21
+ page.fill('input[name="title"]', "Playback Test Post")
22
+
23
+ # We need small dummy files
24
+ with open("test_audio.mp3", "wb") as f:
25
+ f.write(b"dummy audio content")
26
+ with open("test_video.mp4", "wb") as f:
27
+ f.write(b"dummy video content")
28
+
29
+ page.set_input_files('input[name="audio"]', "test_audio.mp3")
30
+ page.set_input_files('input[name="video"]', "test_video.mp4")
31
+
32
+ page.click('button:has-text("Post")')
33
+ page.wait_for_url("https://harvesthealth-dashboards-plotly.hf.space/")
34
+
35
+ # Check feed
36
+ print("Checking feed for media URLs...")
37
+
38
+ # Get audio/video URLs from the page
39
+ audio_src = page.eval_on_selector('audio source', 'el => el.src')
40
+ video_src = page.eval_on_selector('video source', 'el => el.src')
41
+
42
+ print(f"Audio URL: {audio_src}")
43
+ print(f"Video URL: {video_src}")
44
+
45
+ # Check accessibility
46
+ audio_resp = requests.head(audio_src)
47
+ video_resp = requests.head(video_src)
48
+
49
+ if audio_resp.status_code == 200:
50
+ print("SUCCESS: Audio URL returns 200 OK")
51
+ else:
52
+ print(f"FAILURE: Audio URL returns {audio_resp.status_code}")
53
+
54
+ if video_resp.status_code == 200:
55
+ print("SUCCESS: Video URL returns 200 OK")
56
+ else:
57
+ print(f"FAILURE: Video URL returns {video_resp.status_code}")
58
+
59
+ page.screenshot(path="media_playback_verification.png", full_page=True)
60
+ print("Screenshot taken: media_playback_verification.png")
61
+
62
+ browser.close()
63
+
64
+ if __name__ == "__main__":
65
+ run()