File-Generator / app.py
tujestspam's picture
Add 4 files
08e931d verified
Raw
History Blame Contribute Delete
963 Bytes
import gradio as gr
def generate_files(input_file):
output_files = []
# Parse the input file and generate multiple output files based on its contents
with open(input_file, "r") as f:
input_content = f.read()
output_files = parse_input_content(input_content)
return output_files
def parse_input_content(input_content):
# This function parses the input file and returns a list of output files
# The parsing logic can be arbitrarily complex and is not shown here for simplicity
return [("index.html", "ZAWARTOŚĆ PLIKU INDEX.HTML"), ("main.js", "ZAWARTOŚĆ PLIKU MAIN.JS"), ("readme.md", "ZAWARTOŚĆ PLIKU README.MD")]
demo = gr.Interface(generate_files, [gr.Textbox(label="Input file", lines=10)], "list", description="This app takes a single input file and generates multiple output files based on its contents. You can try it out by saving the input file and opening `index.html` in your browser.")
demo.launch()