aigmixer's picture
Update app.py
21c111d
raw
history blame
693 Bytes
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()