ghost717 commited on
Commit
7a8b419
·
1 Parent(s): 96df37b
Files changed (4) hide show
  1. .gitignore +405 -0
  2. app.py +31 -0
  3. requiremenst.txt +2 -0
  4. tools.py +3 -0
.gitignore ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2
+ # Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,django,flask,python
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,django,flask,python
4
+
5
+ *.env*
6
+ *.bak*
7
+
8
+
9
+ ### Django ###
10
+ *.log
11
+ *.pot
12
+ *.pyc
13
+ __pycache__/
14
+ local_settings.py
15
+ db.sqlite3
16
+ db.sqlite3-journal
17
+ media
18
+
19
+ # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
20
+ # in your Git repository. Update and uncomment the following line accordingly.
21
+ # <django-project-name>/staticfiles/
22
+
23
+ ### Django.Python Stack ###
24
+ # Byte-compiled / optimized / DLL files
25
+ *.py[cod]
26
+ *$py.class
27
+
28
+ # C extensions
29
+ *.so
30
+
31
+ # Distribution / packaging
32
+ .Python
33
+ build/
34
+ develop-eggs/
35
+ dist/
36
+ downloads/
37
+ eggs/
38
+ .eggs/
39
+ lib/
40
+ lib64/
41
+ parts/
42
+ sdist/
43
+ var/
44
+ wheels/
45
+ share/python-wheels/
46
+ *.egg-info/
47
+ .installed.cfg
48
+ *.egg
49
+ MANIFEST
50
+
51
+ # PyInstaller
52
+ # Usually these files are written by a python script from a template
53
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
54
+ *.manifest
55
+ *.spec
56
+
57
+ # Installer logs
58
+ pip-log.txt
59
+ pip-delete-this-directory.txt
60
+
61
+ # Unit test / coverage reports
62
+ htmlcov/
63
+ .tox/
64
+ .nox/
65
+ .coverage
66
+ .coverage.*
67
+ .cache
68
+ nosetests.xml
69
+ coverage.xml
70
+ *.cover
71
+ *.py,cover
72
+ .hypothesis/
73
+ .pytest_cache/
74
+ cover/
75
+
76
+ # Translations
77
+ *.mo
78
+
79
+ # Django stuff:
80
+
81
+ # Flask stuff:
82
+ instance/
83
+ .webassets-cache
84
+
85
+ # Scrapy stuff:
86
+ .scrapy
87
+
88
+ # Sphinx documentation
89
+ docs/_build/
90
+
91
+ # PyBuilder
92
+ .pybuilder/
93
+ target/
94
+
95
+ # Jupyter Notebook
96
+ .ipynb_checkpoints
97
+
98
+ # IPython
99
+ profile_default/
100
+ ipython_config.py
101
+
102
+ # pyenv
103
+ # For a library or package, you might want to ignore these files since the code is
104
+ # intended to run in multiple environments; otherwise, check them in:
105
+ # .python-version
106
+
107
+ # pipenv
108
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
109
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
110
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
111
+ # install all needed dependencies.
112
+ #Pipfile.lock
113
+
114
+ # poetry
115
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
116
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
117
+ # commonly ignored for libraries.
118
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
119
+ #poetry.lock
120
+
121
+ # pdm
122
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
123
+ #pdm.lock
124
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
125
+ # in version control.
126
+ # https://pdm.fming.dev/#use-with-ide
127
+ .pdm.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule
134
+ celerybeat.pid
135
+
136
+ # SageMath parsed files
137
+ *.sage.py
138
+
139
+ # Environments
140
+ .env
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ #.idea/
178
+
179
+ ### Flask ###
180
+ instance/*
181
+ !instance/.gitignore
182
+
183
+ ### Flask.Python Stack ###
184
+ # Byte-compiled / optimized / DLL files
185
+
186
+ # C extensions
187
+
188
+ # Distribution / packaging
189
+
190
+ # PyInstaller
191
+ # Usually these files are written by a python script from a template
192
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
193
+
194
+ # Installer logs
195
+
196
+ # Unit test / coverage reports
197
+
198
+ # Translations
199
+
200
+ # Django stuff:
201
+
202
+ # Flask stuff:
203
+
204
+ # Scrapy stuff:
205
+
206
+ # Sphinx documentation
207
+
208
+ # PyBuilder
209
+
210
+ # Jupyter Notebook
211
+
212
+ # IPython
213
+
214
+ # pyenv
215
+ # For a library or package, you might want to ignore these files since the code is
216
+ # intended to run in multiple environments; otherwise, check them in:
217
+ # .python-version
218
+
219
+ # pipenv
220
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
221
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
222
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
223
+ # install all needed dependencies.
224
+
225
+ # poetry
226
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
227
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
228
+ # commonly ignored for libraries.
229
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
230
+
231
+ # pdm
232
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
233
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
234
+ # in version control.
235
+ # https://pdm.fming.dev/#use-with-ide
236
+
237
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
238
+
239
+ # Celery stuff
240
+
241
+ # SageMath parsed files
242
+
243
+ # Environments
244
+
245
+ # Spyder project settings
246
+
247
+ # Rope project settings
248
+
249
+ # mkdocs documentation
250
+
251
+ # mypy
252
+
253
+ # Pyre type checker
254
+
255
+ # pytype static type analyzer
256
+
257
+ # Cython debug symbols
258
+
259
+ # PyCharm
260
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
261
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
262
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
263
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
264
+
265
+ ### Python ###
266
+ # Byte-compiled / optimized / DLL files
267
+
268
+ # C extensions
269
+
270
+ # Distribution / packaging
271
+
272
+ # PyInstaller
273
+ # Usually these files are written by a python script from a template
274
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
275
+
276
+ # Installer logs
277
+
278
+ # Unit test / coverage reports
279
+
280
+ # Translations
281
+
282
+ # Django stuff:
283
+
284
+ # Flask stuff:
285
+
286
+ # Scrapy stuff:
287
+
288
+ # Sphinx documentation
289
+
290
+ # PyBuilder
291
+
292
+ # Jupyter Notebook
293
+
294
+ # IPython
295
+
296
+ # pyenv
297
+ # For a library or package, you might want to ignore these files since the code is
298
+ # intended to run in multiple environments; otherwise, check them in:
299
+ # .python-version
300
+
301
+ # pipenv
302
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
303
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
304
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
305
+ # install all needed dependencies.
306
+
307
+ # poetry
308
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
309
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
310
+ # commonly ignored for libraries.
311
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
312
+
313
+ # pdm
314
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
315
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
316
+ # in version control.
317
+ # https://pdm.fming.dev/#use-with-ide
318
+
319
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
320
+
321
+ # Celery stuff
322
+
323
+ # SageMath parsed files
324
+
325
+ # Environments
326
+
327
+ # Spyder project settings
328
+
329
+ # Rope project settings
330
+
331
+ # mkdocs documentation
332
+
333
+ # mypy
334
+
335
+ # Pyre type checker
336
+
337
+ # pytype static type analyzer
338
+
339
+ # Cython debug symbols
340
+
341
+ # PyCharm
342
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
343
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
344
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
345
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
346
+
347
+ ### Python Patch ###
348
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
349
+ poetry.toml
350
+
351
+ # ruff
352
+ .ruff_cache/
353
+
354
+ # LSP config files
355
+ pyrightconfig.json
356
+
357
+ ### VisualStudioCode ###
358
+ .vscode/*
359
+ !.vscode/settings.json
360
+ !.vscode/tasks.json
361
+ !.vscode/launch.json
362
+ !.vscode/extensions.json
363
+ !.vscode/*.code-snippets
364
+
365
+ # Local History for Visual Studio Code
366
+ .history/
367
+
368
+ # Built Visual Studio Code Extensions
369
+ *.vsix
370
+
371
+ ### VisualStudioCode Patch ###
372
+ # Ignore all local history of files
373
+ .history
374
+ .ionide
375
+
376
+ ### Windows ###
377
+ # Windows thumbnail cache files
378
+ Thumbs.db
379
+ Thumbs.db:encryptable
380
+ ehthumbs.db
381
+ ehthumbs_vista.db
382
+
383
+ # Dump file
384
+ *.stackdump
385
+
386
+ # Folder config file
387
+ [Dd]esktop.ini
388
+
389
+ # Recycle Bin used on file shares
390
+ $RECYCLE.BIN/
391
+
392
+ # Windows Installer files
393
+ *.cab
394
+ *.msi
395
+ *.msix
396
+ *.msm
397
+ *.msp
398
+
399
+ # Windows shortcuts
400
+ *.lnk
401
+
402
+ # End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,django,flask,python
403
+
404
+ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
405
+
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ from gradio_client import Client
3
+ import gradio as gr
4
+ from tools import add_numbers
5
+
6
+ def chatbot_function_calling(user_message, history):
7
+ if "add" in user_message.lower():
8
+ # Przykładowe parsowanie komendy
9
+ try:
10
+ parts = user_message.split()
11
+ a = int(parts[1])
12
+ b = int(parts[2])
13
+ result = add_numbers(a, b)
14
+ response = f"Result: {result}"
15
+ except Exception as e:
16
+ response = f"Error: {str(e)}"
17
+ else:
18
+ response = "I'm sorry, I don't understand the command."
19
+
20
+ history.append((user_message, response))
21
+ return history, history
22
+
23
+ iface = gr.ChatInterface(
24
+ fn=chatbot_function_calling,
25
+ chatbot=gr.Chatbot(height=400),
26
+ textbox=gr.Textbox(show_label=False, placeholder="Send a message..."),
27
+ title="Function Calling Chatbot",
28
+ description="This chatbot can perform simple operations like addition."
29
+ )
30
+
31
+ iface.launch(server_name="0.0.0.0", server_port=7860)
requiremenst.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ gradio_client
tools.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # tools.py
2
+ def add_numbers(a, b):
3
+ return a + b