alozowski HF Staff commited on
Commit
86df3fc
Β·
verified Β·
1 Parent(s): fc5e54d

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +27 -2
  2. app.py +26 -10
  3. config.py +8 -3
  4. requirements.txt +1 -1
  5. test_helper.py +9 -0
README.md CHANGED
@@ -1,2 +1,27 @@
1
- # Frontend Subdirectory
2
- Only files in this directory should be synced to HF Space.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- return f"Hello {name} from the frontend subdirectory!"
 
 
6
 
7
- demo = gr.Interface(
8
- fn=greet,
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
- if __name__ == "__main__":
15
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- """Frontend configuration"""
2
- class FrontendConfig:
3
- APP_NAME = "Frontend Subdirectory Test"
 
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() != ""