File size: 966 Bytes
36d87de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import gradio as gr

def transform(text):
    """
    Simple transformation function for anycoder 2.
    Takes text input and returns reversed text.
    """
    if not text:
        return ""
    return text[::-1]


with gr.Blocks() as demo:
    gr.Markdown(
        "<h1>anycoder 2</h1>"
        '<p><a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">'
        "Built with anycoder</a></p>"
    )

    with gr.Row():
        input_box = gr.Textbox(label="Input Text", placeholder="Type something...")
        output_box = gr.Textbox(label="Output Text")

    run_btn = gr.Button("Run Transformation", variant="primary")

    run_btn.click(
        fn=transform,
        inputs=[input_box],
        outputs=[output_box],
        api_visibility="public"
    )


demo.launch(
    theme=gr.themes.Soft(primary_hue="blue"),
    footer_links=[
        {"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}
    ]
)