Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,18 @@ last_cn_on = False
|
|
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(
|
@@ -79,28 +91,28 @@ with gr.Blocks() as app:
|
|
79 |
)
|
80 |
test_button = gr.Button("Run Test")
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
|
105 |
|
106 |
# Hilfsfunktion zum Anhängen von Logs
|
|
|
61 |
|
62 |
MAX_SEED = 2**32-1
|
63 |
|
64 |
+
with gr.Blocks() as demo:
|
65 |
+
input_box = gr.Textbox(label="Input")
|
66 |
+
output_box = gr.Textbox(label="Output")
|
67 |
+
test_button = gr.Button("Test")
|
68 |
+
|
69 |
+
def dummy_function(text):
|
70 |
+
return f"Echo: {text}"
|
71 |
+
|
72 |
+
test_button.click(dummy_function, inputs=[input_box], outputs=[output_box])
|
73 |
+
|
74 |
+
demo.launch()
|
75 |
+
|
76 |
with gr.Blocks() as app:
|
77 |
# Debug-Log-Feld hinzufügen
|
78 |
debug_log = gr.Textbox(
|
|
|
91 |
)
|
92 |
test_button = gr.Button("Run Test")
|
93 |
|
94 |
+
# Funktion zum Testen
|
95 |
+
def run_test(input_text, debug_log):
|
96 |
+
try:
|
97 |
+
# Eingabe auf bekannte Tests prüfen
|
98 |
+
if input_text == "get_custom_image":
|
99 |
+
result = get_custom_image()
|
100 |
+
else:
|
101 |
+
result = f"Unbekannter Test: {input_text}"
|
102 |
+
# Ergebnis ins Debug-Log schreiben
|
103 |
+
updated_log = debug_log + f"\nTest '{input_text}': {result}"
|
104 |
+
return updated_log
|
105 |
+
except Exception as e:
|
106 |
+
# Fehler ebenfalls ins Debug-Log schreiben
|
107 |
+
updated_log = debug_log + f"\nFehler beim Test '{input_text}': {str(e)}"
|
108 |
+
return updated_log
|
109 |
+
|
110 |
+
# Test-Button mit der Funktion verbinden
|
111 |
+
test_button.click(
|
112 |
+
run_test,
|
113 |
+
inputs=[test_input, debug_log],
|
114 |
+
outputs=debug_log
|
115 |
+
)
|
116 |
|
117 |
|
118 |
# Hilfsfunktion zum Anhängen von Logs
|