Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +27 -2
- app.py +26 -10
- config.py +8 -3
- requirements.txt +1 -1
- test_helper.py +9 -0
README.md
CHANGED
|
@@ -1,2 +1,27 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: HF Sync Test
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 6.5.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# HF Sync Test
|
| 13 |
+
|
| 14 |
+
A simple test Space to verify GitHub β Hugging Face synchronization workflow.
|
| 15 |
+
|
| 16 |
+
## What it does
|
| 17 |
+
|
| 18 |
+
This Space contains a basic Gradio interface that greets users by name. It's used to test automated syncing from GitHub.
|
| 19 |
+
|
| 20 |
+
## Usage
|
| 21 |
+
|
| 22 |
+
Simply enter your name and receive a friendly greeting!
|
| 23 |
+
|
| 24 |
+
## Tech Stack
|
| 25 |
+
|
| 26 |
+
- **Framework**: Gradio
|
| 27 |
+
- **Sync**: Automated via GitHub Actions
|
app.py
CHANGED
|
@@ -1,15 +1,31 @@
|
|
| 1 |
-
"""Frontend Gradio app for subdirectory sync test"""
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
def greet(name):
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
inputs=gr.Textbox(label="Your name"),
|
| 10 |
-
title="Frontend Subdirectory Test",
|
| 11 |
-
description="This app is synced from the frontend/ subdirectory only"
|
| 12 |
-
)
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
+
if not name:
|
| 5 |
+
return "Please enter your name! π"
|
| 6 |
+
return f"Hello {name}! Welcome to the updated HF Sync Test Space! πβ¨"
|
| 7 |
|
| 8 |
+
def reverse_text(text):
|
| 9 |
+
return text[::-1] if text else ""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Create a tabbed interface with multiple functions
|
| 12 |
+
with gr.Blocks(title="HF Sync Test - Updated!") as demo:
|
| 13 |
+
gr.Markdown("# π Hugging Face Sync Test")
|
| 14 |
+
gr.Markdown("### Testing automatic sync from GitHub β HF Space")
|
| 15 |
+
|
| 16 |
+
with gr.Tab("Greeting"):
|
| 17 |
+
name_input = gr.Textbox(label="Enter your name", placeholder="Claude")
|
| 18 |
+
greet_output = gr.Textbox(label="Greeting")
|
| 19 |
+
greet_btn = gr.Button("Greet Me!")
|
| 20 |
+
greet_btn.click(greet, inputs=name_input, outputs=greet_output)
|
| 21 |
+
|
| 22 |
+
with gr.Tab("Text Reverser"):
|
| 23 |
+
text_input = gr.Textbox(label="Enter text to reverse", placeholder="Hello World")
|
| 24 |
+
reverse_output = gr.Textbox(label="Reversed text")
|
| 25 |
+
reverse_btn = gr.Button("Reverse!")
|
| 26 |
+
reverse_btn.click(reverse_text, inputs=text_input, outputs=reverse_output)
|
| 27 |
+
|
| 28 |
+
gr.Markdown("---")
|
| 29 |
+
gr.Markdown("*This Space is auto-synced from GitHub using huggingface-sync-action*")
|
| 30 |
+
|
| 31 |
+
demo.launch()
|
config.py
CHANGED
|
@@ -1,4 +1,9 @@
|
|
| 1 |
-
"""
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 4 |
VERSION = "1.0.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Configuration file - should be tracked"""
|
| 2 |
+
|
| 3 |
+
class Config:
|
| 4 |
+
APP_NAME = "HF Sync Test"
|
| 5 |
VERSION = "1.0.0"
|
| 6 |
+
PORT = 7860
|
| 7 |
+
|
| 8 |
+
# Note: Actual secrets should be in .env (which is gitignored)
|
| 9 |
+
# This file only contains non-sensitive configuration
|
requirements.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
gradio
|
|
|
|
| 1 |
+
gradio
|
test_helper.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Helper functions for testing - should be tracked"""
|
| 2 |
+
|
| 3 |
+
def format_message(text: str) -> str:
|
| 4 |
+
"""Format a message with a prefix."""
|
| 5 |
+
return f"[TEST] {text}"
|
| 6 |
+
|
| 7 |
+
def validate_input(value: str) -> bool:
|
| 8 |
+
"""Validate user input."""
|
| 9 |
+
return len(value) > 0 and value.strip() != ""
|