Spaces:
Configuration error
Configuration error
Upload folder using huggingface_hub
Browse files- README.md +20 -10
- app.py +31 -0
- requirements.txt +1 -0
README.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
| 1 |
-
--
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
| 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
|