Spaces:
Sleeping
Sleeping
Marvin Wiesner commited on
Upload folder using huggingface_hub
Browse files- app.py +39 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def transform(text):
|
| 4 |
+
"""
|
| 5 |
+
Simple transformation function for anycoder 2.
|
| 6 |
+
Takes text input and returns reversed text.
|
| 7 |
+
"""
|
| 8 |
+
if not text:
|
| 9 |
+
return ""
|
| 10 |
+
return text[::-1]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown(
|
| 15 |
+
"<h1>anycoder 2</h1>"
|
| 16 |
+
'<p><a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">'
|
| 17 |
+
"Built with anycoder</a></p>"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
with gr.Row():
|
| 21 |
+
input_box = gr.Textbox(label="Input Text", placeholder="Type something...")
|
| 22 |
+
output_box = gr.Textbox(label="Output Text")
|
| 23 |
+
|
| 24 |
+
run_btn = gr.Button("Run Transformation", variant="primary")
|
| 25 |
+
|
| 26 |
+
run_btn.click(
|
| 27 |
+
fn=transform,
|
| 28 |
+
inputs=[input_box],
|
| 29 |
+
outputs=[output_box],
|
| 30 |
+
api_visibility="public"
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
demo.launch(
|
| 35 |
+
theme=gr.themes.Soft(primary_hue="blue"),
|
| 36 |
+
footer_links=[
|
| 37 |
+
{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}
|
| 38 |
+
]
|
| 39 |
+
)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=6.0
|
| 2 |
+
requests
|
| 3 |
+
Pillow
|