File size: 897 Bytes
3e5274f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr
import os
import runpodctl

def run_command(command):
    # Überprüfung, ob der Befehl eingegeben wurde
    if command:
        output = os.popen(command).read()
        return output
    else:
        return "Bitte geben Sie einen Befehl ein."

# Texteingabefeld erstellen
command_input = gr.inputs.Textbox(label="Enter command")

# Senden-Button erstellen
send_button = gr.inputs.Button(label="Send")

# Ausgabe erstellen
output_text = gr.outputs.Text(label="Output")

def run_app(command):
    output = run_command(command)
    return output

# Gradio Space erstellen
iface = gr.Interface(
    fn=run_app,
    inputs=command_input + send_button,
    outputs=output_text,
    title="Terminal-Befehl ausführen",
    description="Geben Sie den gewünschten Befehl ein und drücken Sie 'Senden', um den Befehl im Terminal auszuführen.",
    theme="default"
)
iface.launch()