Spaces:
Build error

new-space / app.py
anthony9's picture
initial commit
363dcd9 verified
Raw History Blame Contribute Delete
846 Bytes
import gradio as gr
# Function to process the HTML file
def update_html(html_file):
# Read the input HTML file
with open(html_file.name, 'r') as file:
content = file.read()
# Example modification: Add a comment at the beginning of the HTML
updated_content = f"<!-- Processed by Gradio -->\n{content}"
# Save the updated content to a new file
output_file = "updated_file.html"
with open(output_file, 'w') as file:
file.write(updated_content)
# Return the path to the updated file
return output_file
# Gradio Interface
interface = gr.Interface(
fn=update_html, # Function to call
inputs=gr.File(label="Upload HTML File"), # Input widget
outputs=gr.File(label="Download Updated HTML") # Output widget
)
# Launch the interface
if __name__ == "__main__":
interface.launch()