Spaces:
Sleeping
Sleeping
import gradio as gr | |
def to_print_line(text): | |
# Escape double quotes inside the text | |
escaped_text = text.replace('"', '\\"') | |
return f'print("{escaped_text}")' | |
interface = gr.Interface( | |
fn=to_print_line, | |
inputs=gr.Textbox(lines=2, label="Text to print"), | |
outputs=gr.Textbox(lines=2, label="Generated Python Code"), | |
title="🖨️ Simple Python Code Generator", | |
description="Turns your input text into a Python print statement." | |
) | |
if __name__ == "__main__": | |
interface.launch() | |