meraj12 commited on
Commit
cec068d
·
verified ·
1 Parent(s): 0090355

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -8
app.py CHANGED
@@ -1,12 +1,73 @@
1
  import streamlit as st
2
- from generate_video import generate_video_from_text
 
 
 
 
 
3
 
4
- st.title("🎥 Text-to-Video Generator (CPU Only)")
 
 
5
 
6
- prompt = st.text_input("Enter your prompt", "A futuristic cityscape at night")
7
- generate_btn = st.button("Generate Video")
 
 
 
 
 
 
 
 
 
 
8
 
9
- if generate_btn and prompt:
10
- with st.spinner("Generating video..."):
11
- output_path = generate_video_from_text(prompt)
12
- st.video(output_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import requests
3
+ import face_recognition
4
+ import numpy as np
5
+ from PIL import Image
6
+ import os
7
+ import io
8
 
9
+ st.set_page_config(page_title="Face Finder on Internet", layout="centered")
10
+ st.title("🕵️‍♂️ Check if Your Face Exists on the Internet")
11
+ st.markdown("Upload your photo and we'll search for public matches using reverse image search and AI-based face comparison.")
12
 
13
+ # Function to convert uploaded image to face encoding
14
+ def get_face_encoding(image_file):
15
+ try:
16
+ image = face_recognition.load_image_file(image_file)
17
+ encodings = face_recognition.face_encodings(image)
18
+ if encodings:
19
+ return encodings[0]
20
+ else:
21
+ return None
22
+ except Exception as e:
23
+ st.error(f"Error processing image: {e}")
24
+ return None
25
 
26
+ # Function to reverse search using Yandex (via redirect to their site)
27
+ def generate_yandex_link(image_bytes):
28
+ temp_file_path = "temp_image.jpg"
29
+ with open(temp_file_path, "wb") as f:
30
+ f.write(image_bytes)
31
+ return "https://yandex.com/images/search?rpt=imageview&url="
32
+
33
+ # UI: Upload image
34
+ uploaded_file = st.file_uploader("Upload your face image (jpg/png)", type=["jpg", "jpeg", "png"])
35
+
36
+ if uploaded_file:
37
+ # Show uploaded image
38
+ image = Image.open(uploaded_file)
39
+ st.image(image, caption="Uploaded Image", use_column_width=True)
40
+
41
+ # Extract face encoding
42
+ encoding = get_face_encoding(uploaded_file)
43
+
44
+ if encoding is not None:
45
+ st.success("Face encoding extracted successfully ✅")
46
+
47
+ # Convert image to bytes for reverse search
48
+ img_byte_arr = io.BytesIO()
49
+ image.save(img_byte_arr, format='JPEG')
50
+ img_bytes = img_byte_arr.getvalue()
51
+
52
+ # Provide links for manual reverse search
53
+ st.subheader("🔍 Search Your Face on the Web")
54
+ col1, col2, col3 = st.columns(3)
55
+
56
+ with col1:
57
+ st.markdown("[Search on Google](https://images.google.com)")
58
+ st.caption("Upload the same image there manually")
59
+
60
+ with col2:
61
+ st.markdown("[Search on Yandex](https://yandex.com/images)")
62
+ st.caption("Yandex is great for face search")
63
+
64
+ with col3:
65
+ st.markdown("[Search on Bing](https://www.bing.com/visualsearch)")
66
+ st.caption("Another good reverse image search")
67
+
68
+ st.info("These tools let you check if your face appears on the internet. Full automation is limited due to privacy restrictions.")
69
+ else:
70
+ st.warning("No face detected in the uploaded image. Try another photo.")
71
+
72
+ st.markdown("---")
73
+ st.markdown("Created with ❤️ using open-source face recognition models and public search tools.")