Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -61,45 +61,46 @@ last_cn_on = False
|
|
61 |
|
62 |
MAX_SEED = 2**32-1
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
76 |
label="Test Input",
|
77 |
placeholder="Gib den Namen einer Funktion ein, z.B. 'get_custom_image'.",
|
78 |
)
|
79 |
test_button = gr.Button("Run Test")
|
80 |
|
81 |
-
# Funktion zum Testen
|
82 |
-
def run_test(input_text, debug_log):
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
# Test-Button mit der Funktion verbinden
|
98 |
-
test_button.click(
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
)
|
103 |
|
104 |
|
105 |
# Hilfsfunktion zum Anhängen von Logs
|
|
|
61 |
|
62 |
MAX_SEED = 2**32-1
|
63 |
|
64 |
+
with gr.Blocks() as app:
|
65 |
+
# Debug-Log-Feld hinzufügen
|
66 |
+
debug_log = gr.Textbox(
|
67 |
+
label="Debug Log",
|
68 |
+
interactive=False,
|
69 |
+
lines=10,
|
70 |
+
placeholder="Hier erscheinen Debug-Informationen...",
|
71 |
+
type="text" # Nur Text wird akzeptiert
|
72 |
+
)
|
73 |
+
|
74 |
+
# Test-Input-Feld und Button
|
75 |
+
with gr.Row():
|
76 |
+
test_input = gr.Textbox(
|
77 |
label="Test Input",
|
78 |
placeholder="Gib den Namen einer Funktion ein, z.B. 'get_custom_image'.",
|
79 |
)
|
80 |
test_button = gr.Button("Run Test")
|
81 |
|
82 |
+
# Funktion zum Testen
|
83 |
+
def run_test(input_text, debug_log):
|
84 |
+
try:
|
85 |
+
# Eingabe auf bekannte Tests prüfen
|
86 |
+
if input_text == "get_custom_image":
|
87 |
+
result = get_custom_image()
|
88 |
+
else:
|
89 |
+
result = f"Unbekannter Test: {input_text}"
|
90 |
+
# Ergebnis ins Debug-Log schreiben
|
91 |
+
updated_log = debug_log + f"\nTest '{input_text}': {result}"
|
92 |
+
return updated_log
|
93 |
+
except Exception as e:
|
94 |
+
# Fehler ebenfalls ins Debug-Log schreiben
|
95 |
+
updated_log = debug_log + f"\nFehler beim Test '{input_text}': {str(e)}"
|
96 |
+
return updated_log
|
97 |
+
|
98 |
+
# Test-Button mit der Funktion verbinden
|
99 |
+
test_button.click(
|
100 |
+
run_test,
|
101 |
+
inputs=[test_input, debug_log],
|
102 |
+
outputs=debug_log
|
103 |
+
)
|
104 |
|
105 |
|
106 |
# Hilfsfunktion zum Anhängen von Logs
|