LovnishVerma commited on
Commit
102d6ed
Β·
verified Β·
1 Parent(s): 83019af

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -21
README.md CHANGED
@@ -37,45 +37,57 @@ Ensure you have the following installed before running the project:
37
  - 🌐 Flask
38
  - πŸ”— Requests
39
  - πŸ—οΈ BeautifulSoup4 (bs4)
 
40
 
41
- You can install dependencies using:
42
  ```sh
43
- pip install flask requests beautifulsoup4
 
44
  ```
45
 
46
  ## Project Structure
 
47
  πŸ“‚ **Project Directory:**
 
48
  ```
49
  /your_project_directory
50
  │── app.py # πŸ—οΈ Main Flask application
 
 
51
  │── templates/
52
  β”‚ │── index.html # πŸ“„ Home page with form
53
  β”‚ │── result.html # πŸ“„ Page to display scraped data
54
- │── static/ # 🎨 (Optional) CSS/JS files
55
  │── README.md # πŸ“– Project Documentation
 
56
  ```
57
 
58
- ## Usage
59
- πŸš€ **Run the Flask Application:**
60
 
61
- Create start.sh file and write:
62
 
63
- ```sh
64
- python app.py
65
- ```
 
 
 
66
 
67
  🌍 **Access the Web App:**
68
- Open your browser and visit:
 
69
  ```
70
- http://yourprojectname.glitch.me/
 
71
  ```
72
 
73
  πŸ“ **Enter URL and Tag:**
 
74
  1. Provide a valid URL.
75
  2. Specify an HTML tag (e.g., `p`, `h1`, `div`).
76
  3. Click submit to fetch and display the data.
77
 
78
  ## Code
 
79
  ```python
80
  from flask import Flask, render_template, request # Flask is used to create a web app
81
  import requests # To send HTTP requests
@@ -112,23 +124,25 @@ def scrape():
112
  if __name__ == "__main__":
113
  app.run(debug=True) # Debug mode is enabled to show errors in the console
114
 
115
- ```
116
-
117
- ![image](https://github.com/user-attachments/assets/1a81b045-6962-4d62-92b9-ea3260705df2)
118
 
 
119
 
120
  ## Notes
 
121
  ⚠️ **Important Considerations:**
122
- - Works only with publicly accessible websites.
123
- - Some websites may block requests (**Use user-agent headers to avoid 403 errors**).
124
- - Handles missing input errors but does not handle all exceptions.
 
125
 
126
  ## Future Improvements
 
127
  ✨ **Potential Enhancements:**
128
- - πŸ”„ Add support for multiple tags.
129
- - πŸ“œ Implement pagination for large data sets.
130
- - πŸ’Ύ Store scraped data in a database.
 
131
 
132
  ---
133
- πŸŽ‰ **Happy Coding! πŸš€**
134
 
 
 
37
  - 🌐 Flask
38
  - πŸ”— Requests
39
  - πŸ—οΈ BeautifulSoup4 (bs4)
40
+ - πŸ¦„ Gunicorn (for production/deployment)
41
 
42
+ You can install dependencies locally using:
43
  ```sh
44
+ pip install -r requirements.txt
45
+
46
  ```
47
 
48
  ## Project Structure
49
+
50
  πŸ“‚ **Project Directory:**
51
+
52
  ```
53
  /your_project_directory
54
  │── app.py # πŸ—οΈ Main Flask application
55
+ │── Dockerfile # 🐳 Docker configuration for Hugging Face
56
+ │── requirements.txt # πŸ“¦ Project dependencies
57
  │── templates/
58
  β”‚ │── index.html # πŸ“„ Home page with form
59
  β”‚ │── result.html # πŸ“„ Page to display scraped data
 
60
  │── README.md # πŸ“– Project Documentation
61
+
62
  ```
63
 
64
+ ## Usage & Deployment (Hugging Face Spaces)
 
65
 
66
+ This project is configured to easily deploy on **Hugging Face Spaces** using the Docker SDK.
67
 
68
+ πŸš€ **Deploying to Hugging Face:**
69
+
70
+ 1. Create a new Space on [Hugging Face](https://huggingface.co/spaces).
71
+ 2. Set the **Space SDK** to **Docker** and choose the **Blank** template.
72
+ 3. Upload your project files (`app.py`, `Dockerfile`, `requirements.txt`, and the `templates` folder) to the Space.
73
+ 4. The Space will automatically build the container and start the app on port `7860` using `gunicorn`.
74
 
75
  🌍 **Access the Web App:**
76
+ Once the build is complete, your app will be live at your Hugging Face Space URL:
77
+
78
  ```
79
+ [https://yourusername-yourspacename.hf.space/](https://yourusername-yourspacename.hf.space/)
80
+
81
  ```
82
 
83
  πŸ“ **Enter URL and Tag:**
84
+
85
  1. Provide a valid URL.
86
  2. Specify an HTML tag (e.g., `p`, `h1`, `div`).
87
  3. Click submit to fetch and display the data.
88
 
89
  ## Code
90
+
91
  ```python
92
  from flask import Flask, render_template, request # Flask is used to create a web app
93
  import requests # To send HTTP requests
 
124
  if __name__ == "__main__":
125
  app.run(debug=True) # Debug mode is enabled to show errors in the console
126
 
 
 
 
127
 
128
+ ```
129
 
130
  ## Notes
131
+
132
  ⚠️ **Important Considerations:**
133
+
134
+ * Works only with publicly accessible websites.
135
+ * Some websites may block requests (**Use user-agent headers to avoid 403 errors**).
136
+ * Handles missing input errors but does not handle all exceptions.
137
 
138
  ## Future Improvements
139
+
140
  ✨ **Potential Enhancements:**
141
+
142
+ * πŸ”„ Add support for multiple tags.
143
+ * πŸ“œ Implement pagination for large data sets.
144
+ * πŸ’Ύ Store scraped data in a database.
145
 
146
  ---
 
147
 
148
+ πŸŽ‰ **Happy Coding! πŸš€**