initial commit
This commit is contained in:
6
.vscode/settings.json
vendored
Executable file
6
.vscode/settings.json
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||
},
|
||||
"python.formatting.provider": "none"
|
||||
}
|
||||
17
DOCKERFILE
Executable file
17
DOCKERFILE
Executable file
@@ -0,0 +1,17 @@
|
||||
FROM python:3.11.3-alpine
|
||||
WORKDIR /code
|
||||
|
||||
RUN apk --update --upgrade add --no-cache gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev
|
||||
|
||||
RUN python -m pip install --upgrade pip
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
|
||||
#set Enviroment Variables used in FLASK
|
||||
ENV FLASK_APP=app
|
||||
ENV FLASK_RUN_HOST=0.0.0.0
|
||||
ENV FLASK_RUN_PORT=8080
|
||||
EXPOSE 8080
|
||||
|
||||
CMD [ "flask", "run" ]
|
||||
36
app.py
Executable file
36
app.py
Executable file
@@ -0,0 +1,36 @@
|
||||
from flask import Flask, render_template, request, redirect, url_for, make_response
|
||||
from os import makedirs, path
|
||||
import functions
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.route("/upload", methods=["POST"])
|
||||
def upload_file():
|
||||
uploaded_file = request.files["file"]
|
||||
text = request.form["text"]
|
||||
makedirs("uploads", exist_ok=True)
|
||||
|
||||
if uploaded_file.filename != "":
|
||||
filepath = path.join("uploads", uploaded_file.filename)
|
||||
uploaded_file.save(filepath)
|
||||
response_text = functions.convert(filepath)
|
||||
# response = make_response(response_text, 200)
|
||||
# response.mimetype = "text/plain"
|
||||
else:
|
||||
response_text = functions.convert_text(text)
|
||||
# response = make_response(response_text, 200)
|
||||
# response.mimetype = "text/plain"
|
||||
# return response #redirect(url_for('index'))
|
||||
return render_template("index.html", text=response_text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.jinja_env.auto_reload = True
|
||||
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||
app.run(host="0.0.0.0", port=8000)
|
||||
BIN
dockerfile.tar.gz
Executable file
BIN
dockerfile.tar.gz
Executable file
Binary file not shown.
78
functions.py
Executable file
78
functions.py
Executable file
@@ -0,0 +1,78 @@
|
||||
import pdfplumber
|
||||
import re
|
||||
|
||||
import codecs
|
||||
|
||||
|
||||
def convert(file_path=False):
|
||||
if not file_path:
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
|
||||
root = tk.Tk()
|
||||
root.withdraw()
|
||||
file_path = filedialog.askopenfilename(
|
||||
filetypes=[("PDFs", ".pdf")], title="Datei zum konvertieren auswählen!"
|
||||
)
|
||||
|
||||
conv_string = []
|
||||
|
||||
# open PDF
|
||||
with pdfplumber.open(file_path) as pdf:
|
||||
for page in pdf.pages:
|
||||
crop = page.crop((60, 80, page.width, page.height))
|
||||
# first_page = pdf.pages[0]
|
||||
# first_page = first_page.crop((60, 80, first_page.width, first_page.height))
|
||||
text = crop.extract_text(layout=True)
|
||||
no_trail = re.sub("\ +\\n", "\n", text) # cleared trailing spaces
|
||||
no_wrong_nl = re.sub(
|
||||
"\\n\ +([A-Za-z0-9])", r" \1", no_trail
|
||||
) # clear wrong newlins
|
||||
lines = re.split("\n", no_wrong_nl) # split into lines
|
||||
|
||||
test = 1
|
||||
changed_lines = []
|
||||
for line in lines:
|
||||
line, num = re.subn("(:)(.+)", rf"\1 {{{{c{test}::\2}}}}", line)
|
||||
if num > 0:
|
||||
test += 1
|
||||
changed_lines.append(line)
|
||||
new_str = "\n".join(changed_lines).strip()
|
||||
conv_string.append(new_str)
|
||||
|
||||
conv_string = "#################### neue Seite ####################\n".join(
|
||||
conv_string
|
||||
)
|
||||
|
||||
file_path = file_path.replace(".pdf", ".txt")
|
||||
text_file = codecs.open(file_path, "w", "utf-8")
|
||||
text_file.write(conv_string)
|
||||
text_file.close()
|
||||
|
||||
print(f"Alles fertig, die Datei befindet sich unter {file_path}")
|
||||
if not __name__ == "__main__":
|
||||
return conv_string
|
||||
|
||||
|
||||
def convert_text(text):
|
||||
text = str(text)
|
||||
if "\r\n" in text:
|
||||
text = text.replace("\r\n", "\n")
|
||||
|
||||
no_wrong_nl = re.sub("\\n\ +([A-Za-z0-9])", r" \1", text) # clear wrong newlins
|
||||
lines = re.split("\n", no_wrong_nl) # split into lines
|
||||
|
||||
test = 1
|
||||
changed_lines = []
|
||||
for line in lines:
|
||||
line, num = re.subn("(:)(.+)", rf"\1 {{{{c{test}::\2}}}}", line)
|
||||
if num > 0:
|
||||
test += 1
|
||||
changed_lines.append(line)
|
||||
new_str = "\n".join(changed_lines).strip()
|
||||
if not __name__ == "__main__":
|
||||
return new_str
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
convert()
|
||||
BIN
pdfs/Vestibularreflexe, Nystagmus.pdf
Executable file
BIN
pdfs/Vestibularreflexe, Nystagmus.pdf
Executable file
Binary file not shown.
37
pdfs/Vestibularreflexe, Nystagmus.txt
Executable file
37
pdfs/Vestibularreflexe, Nystagmus.txt
Executable file
@@ -0,0 +1,37 @@
|
||||
Vestibulospinale Reflexe
|
||||
• Aufteilung:
|
||||
◦statische Reflexe
|
||||
‣ Def: {{c1:: durch bestimmte Körperhaltung ausgelöst, für Aufrechterhaltung des Gleichgewichts in Stand und Gang, Unterteilt in Steh- und Stellreflexe}}
|
||||
◦statokinetische Reflexe
|
||||
‣ Def: {{c2:: ausgelöst durch Bewegeung, Für Gleichgewicht beim Laufen, Springen}}
|
||||
Vestibulookulärer Reflex -> siehe Hirnstammreflexe
|
||||
• Def: {{c3:: Augenbewegung gegen Kopfbewegung zur Fixierung des Gegenstands bej Kopfbewegung}}
|
||||
• Funktion: {{c4:: Blickstabilisierung, Fixierung Bild auf Netzhaut}}
|
||||
|
||||
|
||||
Nystagmus:
|
||||
• pathologische Arten: {{c5:: Spontannystagmus}}
|
||||
◦Unterteilung
|
||||
‣ Ausfallnystagmus
|
||||
• Def: {{c6:: Zerstören der Vestibularbahn}}
|
||||
• Richtung: {{c7:: von kranker Seite weg}}
|
||||
‣ Reiznystagmus
|
||||
• Def: {{c8:: Reizung des Vestibularapparats}}
|
||||
• Richtung: {{c9:: zu kranker Seite hin}}
|
||||
• physiologische Arten
|
||||
◦vestibulärer Nystagmus
|
||||
‣ rotatorischef Nystagmus
|
||||
• Ursache: {{c10:: Fixierung eines Punkts bei Rotation des Probanden}}
|
||||
• Richtung: {{c11:: in Rotationsrichtung}}
|
||||
‣ postrotatorischer Nystagmus
|
||||
• Ursache: {{c12:: Stopp einer Rotation}}
|
||||
• Richtung: {{c13:: gegen Rotation}}
|
||||
‣ kalorischer Nystagmus
|
||||
• Auslösung: {{c14:: Spülung des Gehörgangs mit kaltem oder warmem Wasser}}
|
||||
• Vorgang: {{c15:: Reizung Bogengang durch Spülung, Bewgeung Endolymphe durch Temperatur}}
|
||||
• Richtung: {{c16:: Warmspülung zeigt der Nystagmus zum gespülten Ohr hin, bei Kaltspülung vom gespülten Ohr weg}}
|
||||
◦optokinetischer Nystagmus = Eisenbahnnystagmus
|
||||
‣ Vorgang:
|
||||
• Augen fixieren Punkt, versuchen diesen so lange wie möglich im Blickfeld zu behalten -> Augenauslenkbewegung
|
||||
• Rückstellbewegung falls Bulbus maximal ausgelenkt
|
||||
‣ Richtung: {{c17:: gegen Bewegung der Umwelt}}
|
||||
2
requirements.txt
Executable file
2
requirements.txt
Executable file
@@ -0,0 +1,2 @@
|
||||
flask
|
||||
pdfplumber
|
||||
24
static/script.js
Executable file
24
static/script.js
Executable file
@@ -0,0 +1,24 @@
|
||||
document.getElementById("myfile").addEventListener("change", (event) => {
|
||||
btn = event.target;
|
||||
filename = btn.files[0].name;
|
||||
btn.parentNode.children[1].innerHTML = filename
|
||||
})
|
||||
try {
|
||||
document.getElementById("copy-btn").addEventListener("click", copy_text);
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError)
|
||||
e = 0;
|
||||
else alert(e);
|
||||
}
|
||||
|
||||
function copy_text(){
|
||||
const copyText = document.getElementById("myInput").textContent.trim();
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.textContent = copyText;
|
||||
document.body.append(textArea);
|
||||
textArea.select();
|
||||
document.execCommand("copy");
|
||||
textArea.style.display = "none";
|
||||
|
||||
// console.log("Hello World!");
|
||||
}
|
||||
42
static/style.css
Executable file
42
static/style.css
Executable file
@@ -0,0 +1,42 @@
|
||||
*{
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
main{
|
||||
display: flex;
|
||||
width: 90vw;
|
||||
height: 50vh;
|
||||
margin: 0 5vw;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
|
||||
main div{
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
textarea{
|
||||
width: 90%;
|
||||
height: 20vh;
|
||||
margin: 20px 0;
|
||||
min-height: fit-content;
|
||||
}
|
||||
|
||||
/* button{
|
||||
border: 1px solid black;
|
||||
padding: 5px;
|
||||
border-radius: 2.5px;
|
||||
} */
|
||||
|
||||
input[type="file"] {
|
||||
display: none;
|
||||
}
|
||||
.custom-file-upload, button {
|
||||
border: 1px solid #313131;
|
||||
background-color: lightgray;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
border-radius: .2rem;
|
||||
}
|
||||
32
templates/index.html
Executable file
32
templates/index.html
Executable file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Upload Text</title>
|
||||
<link rel="stylesheet" href='/static/style.css' />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div id="left">
|
||||
<h1>File Upload Example</h1>
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<label class="custom-file-upload">
|
||||
<input id="myfile" type="file" name="file" accept=".pdf"/>
|
||||
<span>Custom Upload</span>
|
||||
</label>
|
||||
<button type="submit">Upload</button>
|
||||
<br>
|
||||
<textarea name="text">{% if text %}{{ text }}{% else %}Text in here{% endif %}</textarea>
|
||||
</form>
|
||||
</div>
|
||||
{% if text %}
|
||||
<div id="right">
|
||||
<h1>Converted Text</h1>
|
||||
<button id="copy-btn">Copy Text</button>
|
||||
<pre id="myInput">{{ text }}
|
||||
</pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</main>
|
||||
<script src="{{url_for('static', filename='script.js')}}"></script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
uploads/Kanu-B-22.pdf
Executable file
BIN
uploads/Kanu-B-22.pdf
Executable file
Binary file not shown.
BIN
uploads/Programmentwurf_Vorlage_Bescheibung_3IT22-1.pdf
Executable file
BIN
uploads/Programmentwurf_Vorlage_Bescheibung_3IT22-1.pdf
Executable file
Binary file not shown.
49
uploads/Programmentwurf_Vorlage_Bescheibung_3IT22-1.txt
Executable file
49
uploads/Programmentwurf_Vorlage_Bescheibung_3IT22-1.txt
Executable file
@@ -0,0 +1,49 @@
|
||||
Aufgabenvorschlag OOP
|
||||
Namen und Seminargruppe(n) der Studierenden:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Projekttitel
|
||||
|
||||
Beschreibung des Programmvorschlags (inkl. Programmiersprache)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Skizzen
|
||||
|
||||
(als Bild einfügen und separat per E-Mail einreichen)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mindestumfang
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mögliche Erweiterungen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__________________________ __________ __________ __________ Ort, Datum Unterschriften
|
||||
_________ _________
|
||||
BIN
uploads/Vestibularreflexe, Nystagmus.pdf
Executable file
BIN
uploads/Vestibularreflexe, Nystagmus.pdf
Executable file
Binary file not shown.
37
uploads/Vestibularreflexe, Nystagmus.txt
Executable file
37
uploads/Vestibularreflexe, Nystagmus.txt
Executable file
@@ -0,0 +1,37 @@
|
||||
Vestibulospinale Reflexe
|
||||
• Aufteilung:
|
||||
◦statische Reflexe
|
||||
‣ Def: {{c1:: durch bestimmte Körperhaltung ausgelöst, für Aufrechterhaltung des Gleichgewichts in Stand und Gang, Unterteilt in Steh- und Stellreflexe}}
|
||||
◦statokinetische Reflexe
|
||||
‣ Def: {{c2:: ausgelöst durch Bewegeung, Für Gleichgewicht beim Laufen, Springen}}
|
||||
Vestibulookulärer Reflex -> siehe Hirnstammreflexe
|
||||
• Def: {{c3:: Augenbewegung gegen Kopfbewegung zur Fixierung des Gegenstands bej Kopfbewegung}}
|
||||
• Funktion: {{c4:: Blickstabilisierung, Fixierung Bild auf Netzhaut}}
|
||||
|
||||
|
||||
Nystagmus:
|
||||
• pathologische Arten: {{c5:: Spontannystagmus}}
|
||||
◦Unterteilung
|
||||
‣ Ausfallnystagmus
|
||||
• Def: {{c6:: Zerstören der Vestibularbahn}}
|
||||
• Richtung: {{c7:: von kranker Seite weg}}
|
||||
‣ Reiznystagmus
|
||||
• Def: {{c8:: Reizung des Vestibularapparats}}
|
||||
• Richtung: {{c9:: zu kranker Seite hin}}
|
||||
• physiologische Arten
|
||||
◦vestibulärer Nystagmus
|
||||
‣ rotatorischef Nystagmus
|
||||
• Ursache: {{c10:: Fixierung eines Punkts bei Rotation des Probanden}}
|
||||
• Richtung: {{c11:: in Rotationsrichtung}}
|
||||
‣ postrotatorischer Nystagmus
|
||||
• Ursache: {{c12:: Stopp einer Rotation}}
|
||||
• Richtung: {{c13:: gegen Rotation}}
|
||||
‣ kalorischer Nystagmus
|
||||
• Auslösung: {{c14:: Spülung des Gehörgangs mit kaltem oder warmem Wasser}}
|
||||
• Vorgang: {{c15:: Reizung Bogengang durch Spülung, Bewgeung Endolymphe durch Temperatur}}
|
||||
• Richtung: {{c16:: Warmspülung zeigt der Nystagmus zum gespülten Ohr hin, bei Kaltspülung vom gespülten Ohr weg}}
|
||||
◦optokinetischer Nystagmus = Eisenbahnnystagmus
|
||||
‣ Vorgang:
|
||||
• Augen fixieren Punkt, versuchen diesen so lange wie möglich im Blickfeld zu behalten -> Augenauslenkbewegung
|
||||
• Rückstellbewegung falls Bulbus maximal ausgelenkt
|
||||
‣ Richtung: {{c17:: gegen Bewegung der Umwelt}}
|
||||
Reference in New Issue
Block a user