etechoptimist
commited on
Commit
·
dec98e0
1
Parent(s):
aceb475
First Gradio Space
Browse files- .gitignore +10 -0
- .python-version +1 -0
- README.md +0 -13
- app.py +30 -0
- pyproject.toml +9 -0
- uv.lock +0 -0
.gitignore
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python-generated files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[oc]
|
| 4 |
+
build/
|
| 5 |
+
dist/
|
| 6 |
+
wheels/
|
| 7 |
+
*.egg-info
|
| 8 |
+
|
| 9 |
+
# Virtual environments
|
| 10 |
+
.venv
|
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.13.1
|
README.md
CHANGED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Software Anomalies
|
| 3 |
-
emoji: 📉
|
| 4 |
-
colorFrom: pink
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 5.33.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def letter_counter(word: str, letter: str) -> int:
|
| 4 |
+
"""
|
| 5 |
+
Count the number of occurrences of a letter in a word or text.
|
| 6 |
+
|
| 7 |
+
Args:
|
| 8 |
+
word (str): The input text to search through
|
| 9 |
+
letter (str): The letter to search for
|
| 10 |
+
|
| 11 |
+
Returns:
|
| 12 |
+
int: The number of times the letter appears in the text
|
| 13 |
+
"""
|
| 14 |
+
word = word.lower()
|
| 15 |
+
letter = letter.lower()
|
| 16 |
+
count = word.count(letter)
|
| 17 |
+
return count
|
| 18 |
+
|
| 19 |
+
# Create a standard Gradio interface
|
| 20 |
+
demo = gr.Interface(
|
| 21 |
+
fn=letter_counter,
|
| 22 |
+
inputs=["textbox", "textbox"],
|
| 23 |
+
outputs="number",
|
| 24 |
+
title="Letter Counter",
|
| 25 |
+
description="Enter text and a letter to count how many times the letter appears in the text."
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Launch both the Gradio web interface and the MCP server
|
| 29 |
+
if __name__ == "__main__":
|
| 30 |
+
demo.launch(mcp_server=True)
|
pyproject.toml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "software_anomalies_detection"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Add your description here"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.13"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"gradio[mcp]>=5.33.0",
|
| 9 |
+
]
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|