fariasultana commited on
Commit
2e04129
·
verified ·
1 Parent(s): dbddf98

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +20 -10
  2. app.py +31 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,12 +1,22 @@
1
- ---
2
- title: Cli Test Space
3
- emoji:
4
- colorFrom: pink
5
- colorTo: red
6
- sdk: gradio
7
- sdk_version: 6.1.0
8
- app_file: app.py
9
- pinned: false
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # cli-test-space
2
+
3
+ A Hugging Face Space created programmatically with Python.
4
+
5
+ ## Features
6
+
7
+ - **Greeting**: Personalized welcome messages
8
+ - **Text Analysis**: Word and character counting
9
+
10
+ ## Technical
11
+
12
+ - Framework: Gradio
13
+ - SDK: Gradio (Python)
14
+ - Hosted on: Hugging Face Spaces
15
+
16
+ ## Created
17
+
18
+ This space was created using the `huggingface_hub` Python library programmatically.
19
+
20
  ---
21
 
22
+ **Powered by Hugging Face Spaces API**
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def greet(user_name):
4
+ if not user_name:
5
+ return "Please enter your name"
6
+ return f"Hello {user_name}! 👋"
7
+
8
+ def analyze_text(text):
9
+ if not text:
10
+ return "No text provided"
11
+ words = len(text.split())
12
+ chars = len(text)
13
+ return f"Words: {words}, Characters: {chars}"
14
+
15
+ with gr.Blocks(title="cli-test-space") as demo:
16
+ gr.Markdown("# cli-test-space\n\n🚀 A Hugging Face Space!")
17
+
18
+ with gr.Tab("👋 Greeting"):
19
+ name_input = gr.Textbox(label="Enter your name")
20
+ greet_btn = gr.Button("Say Hello")
21
+ greet_output = gr.Textbox(label="Greeting")
22
+ greet_btn.click(greet, inputs=name_input, outputs=greet_output)
23
+
24
+ with gr.Tab("📝 Text Analysis"):
25
+ text_input = gr.Textbox(label="Enter text", lines=3)
26
+ analyze_btn = gr.Button("Analyze")
27
+ text_output = gr.Textbox(label="Analysis")
28
+ analyze_btn.click(analyze_text, inputs=text_input, outputs=text_output)
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio>=6.0.0\n