File size: 693 Bytes
f845b05
f8bf4b8
67fbe89
21c111d
f845b05
21c111d
 
 
 
 
 
 
 
 
 
 
4eb15f6
418b839
21c111d
7febfc4
21c111d
cd1c689
21c111d
f8bf4b8
f845b05
21c111d
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
import gradio as gr
import subprocess
import piper
import os

def run_command_and_get_file(command):
    # Run the command
    subprocess.run(command, shell=True, text=True, capture_output=True)

    # Assuming the command creates a file with a known name
    file_path = 'output.txt'  # Replace with the actual expected file path

    if os.path.exists(file_path):
        return file_path
    else:
        return "No file generated."

iface = gr.Interface(
    fn=run_command_and_get_file,
    inputs='text',
    outputs='file',  # Output type changed to 'file'
    title="CLI Interface",
    description="Enter your command. If a file is generated, you can download it."
)

iface.launch()