Update app.py
Browse files
app.py
CHANGED
|
@@ -665,10 +665,11 @@ def custom_css():
|
|
| 665 |
# Bot- test gegen schädliche Bots die die Anwendung testen...
|
| 666 |
# Funktion zur Überprüfung der Benutzereingabe
|
| 667 |
def validate_input(user_input):
|
| 668 |
-
|
| 669 |
-
|
|
|
|
| 670 |
else:
|
| 671 |
-
return "Falsche Antwort
|
| 672 |
|
| 673 |
def launch_main_app(_):
|
| 674 |
# Schließt das Validierungs-Interface und startet die Hauptanwendung
|
|
@@ -682,7 +683,7 @@ print ("Start GUI Vorabfrage")
|
|
| 682 |
validation_interface = gr.Interface(
|
| 683 |
fn=validate_input,
|
| 684 |
inputs=gr.Textbox(label="Bitte tippen Sie das oben im Moodle Kurs angegebene Wort ein, um zu beweisen, dass Sie kein Bot sind."),
|
| 685 |
-
outputs=[gr.
|
| 686 |
live=True # Aktiviert die Live-Aktualisierung ohne Submit-Button
|
| 687 |
)
|
| 688 |
|
|
|
|
| 665 |
# Bot- test gegen schädliche Bots die die Anwendung testen...
|
| 666 |
# Funktion zur Überprüfung der Benutzereingabe
|
| 667 |
def validate_input(user_input):
|
| 668 |
+
user_input_hashed = hash_input(user_input.lower())
|
| 669 |
+
if user_input_hashed == correct_hash:
|
| 670 |
+
return "Richtig! Du kannst jetzt die App nutzen."
|
| 671 |
else:
|
| 672 |
+
return "Falsche Antwort!"
|
| 673 |
|
| 674 |
def launch_main_app(_):
|
| 675 |
# Schließt das Validierungs-Interface und startet die Hauptanwendung
|
|
|
|
| 683 |
validation_interface = gr.Interface(
|
| 684 |
fn=validate_input,
|
| 685 |
inputs=gr.Textbox(label="Bitte tippen Sie das oben im Moodle Kurs angegebene Wort ein, um zu beweisen, dass Sie kein Bot sind."),
|
| 686 |
+
outputs=[gr.Text(label="Überprüfungsergebnis")],
|
| 687 |
live=True # Aktiviert die Live-Aktualisierung ohne Submit-Button
|
| 688 |
)
|
| 689 |
|