Download app.py from anthony9/new-space: direct link, hf CLI and curl.
- Browser
- Download file 846 Bytes
-
https://huggingface.co/spaces/anthony9/new-space/resolve/main/app.py
- Command line
-
hf download hf://spaces/anthony9/new-space/app.py
-
curl -L -o app.py https://huggingface.co/spaces/anthony9/new-space/resolve/main/app.py
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() | |