goldendevuz commited on
Commit
44a93ef
Β·
1 Parent(s): 0ff0732

2025.07.08/15:04

Browse files
Files changed (5) hide show
  1. .gitignore +180 -0
  2. Makefile +23 -0
  3. README.md +46 -10
  4. app.py +1 -2
  5. double_model.py +3 -0
.gitignore ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ .idea/
169
+
170
+ # PyPI configuration file
171
+ .pypirc
172
+
173
+ #other
174
+ playground/
175
+ staticfiles/
176
+ media/
177
+
178
+ # Ignore migration files, but not __init__.py
179
+ **/migrations/*
180
+ !**/migrations/__init__.py
Makefile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ init-env:
2
+ python3 -m venv env
3
+
4
+ i:
5
+ pip install --upgrade pip && pip install -r requirements.txt
6
+
7
+ run:
8
+ python app.py
9
+
10
+ build:
11
+ COMPOSE_BAKE=true docker compose build
12
+
13
+ up:
14
+ COMPOSE_BAKE=true docker compose up
15
+
16
+ stop:
17
+ docker compose stop
18
+
19
+ down:
20
+ docker compose down
21
+
22
+ bash:
23
+ docker exec -it aiobot bash
README.md CHANGED
@@ -1,13 +1,49 @@
1
  ---
2
- title: Double Model Demo
3
- emoji: πŸ’»
4
- colorFrom: purple
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 5.35.0
8
- app_file: app.py
9
- pinned: false
10
- license: gpl-3.0
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: "en"
3
+ license: "mit"
4
+ tags:
5
+ - toy-model
6
+ - beginner
7
+ - number
8
+ - demo
9
+ - simple
10
+ model_type: "custom"
11
+ pipeline_tag: "other"
12
  ---
13
 
14
+ # 🧠 Double Model
15
+
16
+ A tiny demonstration model that simply **doubles any number** you give it.
17
+
18
+ This is **not a machine learning model**, but a toy example to show how to upload custom models to Hugging Face Hub.
19
+
20
+ ## πŸ“¦ How It Works
21
+
22
+ The model has one method:
23
+
24
+ ```python
25
+ def predict(number):
26
+ return number * 2
27
+ ```
28
+
29
+ ## πŸ› οΈ Usage Example
30
+
31
+ ```python
32
+ from double_model import DoubleModel
33
+ model = DoubleModel()
34
+ print(model.predict(10)) # ➜ 20
35
+ ```
36
+
37
+ ## πŸ“ Files Included
38
+
39
+ - `double_model.py` β€” the model class
40
+ - `double_model.pkl` β€” the pickled version of the model
41
+ - `README.md` β€” model card
42
+
43
+ ## πŸ“„ License
44
+
45
+ MIT License
46
+
47
+ ## πŸ€– Author
48
+
49
+ [goldendevuz](https://huggingface.co/goldendevuz)
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import pickle
3
 
4
- # Load the pickled model
5
  with open("double_model.pkl", "rb") as f:
6
  model = pickle.load(f)
7
 
@@ -13,7 +12,7 @@ demo = gr.Interface(
13
  inputs=gr.Number(label="Enter a number"),
14
  outputs=gr.Number(label="Doubled result"),
15
  title="🧠 Double Model",
16
- description="This demo takes a number and returns double using a toy model.",
17
  )
18
 
19
  if __name__ == "__main__":
 
1
  import gradio as gr
2
  import pickle
3
 
 
4
  with open("double_model.pkl", "rb") as f:
5
  model = pickle.load(f)
6
 
 
12
  inputs=gr.Number(label="Enter a number"),
13
  outputs=gr.Number(label="Doubled result"),
14
  title="🧠 Double Model",
15
+ description="Enter a number and get double. Just a toy demo model.",
16
  )
17
 
18
  if __name__ == "__main__":
double_model.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ class DoubleModel:
2
+ def predict(self, number):
3
+ return number * 2