-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0594702
commit c9dc00e
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM debian:stable-20230502-slim | ||
|
||
# Install Python3 and pip3 | ||
RUN apt-get update && apt-get install -y python3 python3-pip | ||
|
||
# Install python-docx library | ||
RUN pip3 install python-docx==0.8.10 | ||
RUN pip3 install flask | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy your Python code to the container | ||
COPY app.py . | ||
|
||
# Run your Python code when the container starts | ||
CMD ["python3", "app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from flask import Flask, render_template, request | ||
import docx | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/', methods=['GET', 'POST']) | ||
def upload_file(): | ||
if request.method == 'POST': | ||
file = request.files['file'] | ||
if file: | ||
document = docx.Document(file) | ||
main_content = '\n\n'.join([paragraph.text for paragraph in document.paragraphs]) | ||
# Print the main content to the console | ||
print(main_content) | ||
return 'File uploaded and parsed successfully!' | ||
return render_template('upload.html') | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0') |