macgaga commited on
Commit
67f02a2
·
verified ·
1 Parent(s): 29eb68a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -34
app.py CHANGED
@@ -61,45 +61,46 @@ last_cn_on = False
61
 
62
  MAX_SEED = 2**32-1
63
 
64
- # Debug-Log-Feld hinzufügen
65
- debug_log = gr.Textbox(
66
- label="Debug Log",
67
- interactive=False,
68
- lines=10,
69
- placeholder="Hier erscheinen Debug-Informationen...",
70
- type="text" # Nur Text wird akzeptiert
71
- )
72
-
73
- # Test-Input-Feld und Button
74
- with gr.Row():
75
- test_input = gr.Textbox(
 
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
- try:
84
- # Eingabe auf bekannte Tests prüfen
85
- if input_text == "get_custom_image":
86
- result = get_custom_image()
87
- else:
88
- result = f"Unbekannter Test: {input_text}"
89
- # Ergebnis ins Debug-Log schreiben
90
- updated_log = debug_log + f"\nTest '{input_text}': {result}"
91
- return updated_log
92
- except Exception as e:
93
- # Fehler ebenfalls ins Debug-Log schreiben
94
- updated_log = debug_log + f"\nFehler beim Test '{input_text}': {str(e)}"
95
- return updated_log
96
-
97
- # Test-Button mit der Funktion verbinden
98
- test_button.click(
99
- run_test,
100
- inputs=[test_input, debug_log],
101
- outputs=debug_log
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