Aarifkhan commited on
Commit
5d052d8
1 Parent(s): 2ee03ec

Upload 3 files

Browse files
Files changed (3) hide show
  1. image.py +28 -0
  2. requirements.txt +4 -0
  3. templates/image.html +138 -0
image.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ from webscout import WEBS
3
+ import arrow
4
+
5
+ app = Flask(__name__)
6
+
7
+ @app.route('/', methods=['GET'])
8
+ def home():
9
+ keywords = request.args.get('keywords', 'india')
10
+ image_list = []
11
+ with WEBS() as webs_instance:
12
+ WEBS_images_gen = webs_instance.images(
13
+ keywords,
14
+ region="wt-wt",
15
+ safesearch="off",
16
+ size=None,
17
+ type_image=None,
18
+ layout=None,
19
+ license_image=None,
20
+ max_results=100
21
+ )
22
+ for r in WEBS_images_gen:
23
+ image_list.append(r)
24
+ print(r['image']) # Print the image URL to check if it's valid
25
+ return render_template('image.html', image=image_list, keywords=keywords)
26
+
27
+ if __name__ == '__main__':
28
+ app.run(debug=True)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ git+https://github.com/OE-LUCIFER/Webscout.git
2
+ requests
3
+ flask
4
+ arrow
templates/image.html ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>InfoHive - Image Search</title>
7
+ <meta name="description" content="InfoHive is a search engine that provides the latest images on technology, sports, and more.">
8
+ <meta property="og:title" content="InfoHive - Image Search">
9
+ <meta property="og:description" content="InfoHive is a search engine that provides the latest images on technology, sports, and more.">
10
+ <meta property="og:image" content="https://raw.githubusercontent.com/OE-LUCIFER/HelpingAI-vortex3b/main/techscout.jpeg">
11
+ <meta property="og:url" content="https://abhaukoul-techscout-news.hf.space/">
12
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
13
+ <link rel="icon" href="favicon.ico" type="image/x-icon">
14
+ <style>
15
+
16
+ body {
17
+ font-family: sans-serif;
18
+ margin: 0;
19
+ background: #000;
20
+ color: #fff;
21
+ }
22
+ .container {
23
+ padding-top: 50px;
24
+ }
25
+ .jumbotron {
26
+ background-color: #007bff;
27
+ color: #fff;
28
+ padding: 2rem 2rem;
29
+ margin-bottom: 30px;
30
+ }
31
+ .card {
32
+ border: none;
33
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
34
+ transition: transform 0.3s;
35
+ }
36
+ .card:hover {
37
+ transform: translateY(-5px);
38
+ }
39
+ .card-title {
40
+ font-size: 20px;
41
+ font-weight: bold;
42
+ color: #333;
43
+ }
44
+ .card-text {
45
+ color: #666;
46
+ }
47
+ .card-footer {
48
+ background-color: #f9f9f9;
49
+ border-top: none;
50
+ }
51
+ .btn-primary {
52
+ background-color: #007bff;
53
+ border-color: #007bff;
54
+ }
55
+ .btn-primary:hover {
56
+ background-color: #0056b3;
57
+ border-color: #0056b3;
58
+ }
59
+ .btn-outline-primary {
60
+ color: #007bff;
61
+ border-color: #007bff;
62
+ }
63
+ .btn-outline-primary:hover {
64
+ background-color: #007bff;
65
+ color: #fff;
66
+ }
67
+ .no-results {
68
+ text-align: center;
69
+ font-style: italic;
70
+ margin-top: 20px;
71
+ }
72
+ .search-input {
73
+ border-radius: 24px;
74
+ }
75
+ .logo {
76
+ max-width: 200px;
77
+ }
78
+ .subscribe-btn {
79
+ background-color: #ff0000;
80
+ border-color: #ff0000;
81
+ }
82
+ .subscribe-btn:hover {
83
+ background-color: #cc0000;
84
+ border-color: #cc0000;
85
+ }
86
+ </style>
87
+ </head>
88
+ <body>
89
+ <div class="container">
90
+ <div class="jumbotron" style="margin-top: 100px;">
91
+ <h1 class="display-4 text-center mb-4">Explore the Latest Images</h1>
92
+ <p class="lead text-center">InfoHive is your source for up-to-date images on technology, sports, and more.</p>
93
+ <div class="text-center">
94
+ <a href="https://youtube.com/@OEvortex" class="btn btn-primary subscribe-btn" target="_blank">Subscribe to OEvortex on YouTube</a>
95
+ </div>
96
+ </div>
97
+ <div class="card mb-4">
98
+ <div class="card-body">
99
+ <form method="GET" action="/">
100
+ <div class="form-row">
101
+ <div class="col-md-8">
102
+ <input type="text" class="form-control search-input" name="keywords" placeholder="Enter keywords" value="{{ keywords }}">
103
+ </div>
104
+ <div class="col-md-2">
105
+ <button type="submit" class="btn btn-primary btn-block">Search</button>
106
+ </div>
107
+ </div>
108
+ </form>
109
+ </div>
110
+ </div>
111
+ {% if image %}
112
+ <div class="row">
113
+ {% for image_item in image %}
114
+ <div class="col-md-4 mb-4">
115
+ <div class="card">
116
+ <img src="{{ image_item['image'] }}" class="card-img-top" alt="{{ image_item['title'] }}">
117
+ <div class="card-body">
118
+ <h5 class="card-title">{{ image_item['title'] }}</h5>
119
+ <p class="card-text">
120
+ <small class="text-muted">
121
+ <!-- Source: {{ image_item['source'] }} -->
122
+ </small>
123
+ </p>
124
+ <!-- <p class="card-text">{{ image_item['url'] }}</p> -->
125
+ </div>
126
+ <div class="card-footer">
127
+ <a href="{{ image_item['url'] }}" class="btn btn-outline-primary btn-sm">View Image</a>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ {% endfor %}
132
+ </div>
133
+ {% else %}
134
+ <p class="no-results">No results found.</p>
135
+ {% endif %}
136
+ </div>
137
+ </body>
138
+ </html>