Workout / app.py
Shreyas1441AI's picture
Create app.py
1818ccd verified
raw
history blame contribute delete
891 Bytes
import gradio as gr
from pathlib import Path
# Path to your custom HTML file
html_path = Path(__file__).parent / "index.html"
# Read your custom HTML content
with open(html_path, "r", encoding="utf-8") as f:
html_content = f.read()
# Define a simple backend function (optional)
def backend_process(input_text):
return f"✅ You entered: {input_text}"
# Create Gradio Blocks with HTML as main interface
with gr.Blocks(title="Custom HTML Gradio App") as demo:
gr.HTML(html_content) # This loads your index.html content
# Optional — backend I/O (use only if needed)
with gr.Row():
input_box = gr.Textbox(label="Enter Something")
output_box = gr.Textbox(label="Response")
run_button = gr.Button("Submit")
run_button.click(fn=backend_process, inputs=input_box, outputs=output_box)
# Launch
if __name__ == "__main__":
demo.launch()