| import gradio as gr | |
| def main_function(input_data): | |
| if not input_data: | |
| return "Please provide input" | |
| result = f"Processed successfully! Input received: {input_data}" | |
| return result | |
| with gr.Blocks(title="heartlib") as demo: | |
| gr.Markdown(f""" | |
| # Heartlib | |
| <p align="center"> | |
| This space was created from: [https://github.com/HeartMuLa/heartlib](https://github.com/HeartMuLa/heartlib) | |
| """) | |
| with gr.Row(): | |
| with gr.Column(): | |
| input_data = gr.Textbox( | |
| label="Input", | |
| placeholder="Enter your input here...", | |
| lines=3 | |
| ) | |
| process_btn = gr.Button("Process", variant="primary") | |
| with gr.Column(): | |
| output_data = gr.Textbox(label="Output") | |
| process_btn.click( | |
| fn=main_function, | |
| inputs=input_data, | |
| outputs=output_data | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |