Spaces:
Sleeping
Sleeping
Marko Vukovic
commited on
Commit
·
afdd51b
0
Parent(s):
Initial public release
Browse files- .gitattributes +35 -0
- .gitignore +311 -0
- Dockerfile +9 -0
- README.md +13 -0
- app.py +44 -0
- poetry.lock +0 -0
- pyproject.toml +16 -0
- requirements.txt +2 -0
- sh/reqs.sh +3 -0
- sh/start.sh +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Python ###
|
| 2 |
+
# Byte-compiled / optimized / DLL files
|
| 3 |
+
__pycache__/
|
| 4 |
+
*.py[cod]
|
| 5 |
+
*$py.class
|
| 6 |
+
|
| 7 |
+
# C extensions
|
| 8 |
+
*.so
|
| 9 |
+
|
| 10 |
+
# Distribution / packaging
|
| 11 |
+
.Python
|
| 12 |
+
build/
|
| 13 |
+
develop-eggs/
|
| 14 |
+
dist/
|
| 15 |
+
downloads/
|
| 16 |
+
eggs/
|
| 17 |
+
.eggs/
|
| 18 |
+
lib/
|
| 19 |
+
lib64/
|
| 20 |
+
parts/
|
| 21 |
+
sdist/
|
| 22 |
+
var/
|
| 23 |
+
wheels/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# PyInstaller
|
| 31 |
+
# Usually these files are written by a python script from a template
|
| 32 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 33 |
+
*.manifest
|
| 34 |
+
*.spec
|
| 35 |
+
|
| 36 |
+
# Installer logs
|
| 37 |
+
pip-log.txt
|
| 38 |
+
pip-delete-this-directory.txt
|
| 39 |
+
|
| 40 |
+
# Unit test / coverage reports
|
| 41 |
+
htmlcov/
|
| 42 |
+
.tox/
|
| 43 |
+
.nox/
|
| 44 |
+
.coverage
|
| 45 |
+
.coverage.*
|
| 46 |
+
.cache
|
| 47 |
+
nosetests.xml
|
| 48 |
+
coverage.xml
|
| 49 |
+
*.cover
|
| 50 |
+
*.py,cover
|
| 51 |
+
.hypothesis/
|
| 52 |
+
.pytest_cache/
|
| 53 |
+
cover/
|
| 54 |
+
|
| 55 |
+
# Translations
|
| 56 |
+
*.mo
|
| 57 |
+
*.pot
|
| 58 |
+
|
| 59 |
+
# Django stuff:
|
| 60 |
+
*.log
|
| 61 |
+
local_settings.py
|
| 62 |
+
db.sqlite3
|
| 63 |
+
db.sqlite3-journal
|
| 64 |
+
|
| 65 |
+
# Flask stuff:
|
| 66 |
+
instance/
|
| 67 |
+
.webassets-cache
|
| 68 |
+
|
| 69 |
+
# Scrapy stuff:
|
| 70 |
+
.scrapy
|
| 71 |
+
|
| 72 |
+
# Sphinx documentation
|
| 73 |
+
docs/_build/
|
| 74 |
+
|
| 75 |
+
# PyBuilder
|
| 76 |
+
.pybuilder/
|
| 77 |
+
target/
|
| 78 |
+
|
| 79 |
+
# Jupyter Notebook
|
| 80 |
+
.ipynb_checkpoints
|
| 81 |
+
|
| 82 |
+
# IPython
|
| 83 |
+
profile_default/
|
| 84 |
+
ipython_config.py
|
| 85 |
+
|
| 86 |
+
# pyenv
|
| 87 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 88 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 89 |
+
# .python-version
|
| 90 |
+
|
| 91 |
+
# pipenv
|
| 92 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 93 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 94 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 95 |
+
# install all needed dependencies.
|
| 96 |
+
#Pipfile.lock
|
| 97 |
+
|
| 98 |
+
# poetry
|
| 99 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 100 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 101 |
+
# commonly ignored for libraries.
|
| 102 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 103 |
+
#poetry.lock
|
| 104 |
+
|
| 105 |
+
# pdm
|
| 106 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 107 |
+
#pdm.lock
|
| 108 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 109 |
+
# in version control.
|
| 110 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 111 |
+
.pdm.toml
|
| 112 |
+
|
| 113 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 114 |
+
__pypackages__/
|
| 115 |
+
|
| 116 |
+
# Celery stuff
|
| 117 |
+
celerybeat-schedule
|
| 118 |
+
celerybeat.pid
|
| 119 |
+
|
| 120 |
+
# SageMath parsed files
|
| 121 |
+
*.sage.py
|
| 122 |
+
|
| 123 |
+
# Environments
|
| 124 |
+
.env
|
| 125 |
+
.venv
|
| 126 |
+
env/
|
| 127 |
+
venv/
|
| 128 |
+
ENV/
|
| 129 |
+
env.bak/
|
| 130 |
+
venv.bak/
|
| 131 |
+
|
| 132 |
+
# Spyder project settings
|
| 133 |
+
.spyderproject
|
| 134 |
+
.spyproject
|
| 135 |
+
|
| 136 |
+
# Rope project settings
|
| 137 |
+
.ropeproject
|
| 138 |
+
|
| 139 |
+
# mkdocs documentation
|
| 140 |
+
/site
|
| 141 |
+
|
| 142 |
+
# mypy
|
| 143 |
+
.mypy_cache/
|
| 144 |
+
.dmypy.json
|
| 145 |
+
dmypy.json
|
| 146 |
+
|
| 147 |
+
# Pyre type checker
|
| 148 |
+
.pyre/
|
| 149 |
+
|
| 150 |
+
# pytype static type analyzer
|
| 151 |
+
.pytype/
|
| 152 |
+
|
| 153 |
+
# Cython debug symbols
|
| 154 |
+
cython_debug/
|
| 155 |
+
|
| 156 |
+
# PyCharm
|
| 157 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 158 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 159 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 160 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 161 |
+
#.idea/
|
| 162 |
+
|
| 163 |
+
### Python Patch ###
|
| 164 |
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
| 165 |
+
poetry.toml
|
| 166 |
+
|
| 167 |
+
# ruff
|
| 168 |
+
.ruff_cache/
|
| 169 |
+
|
| 170 |
+
# LSP config files
|
| 171 |
+
pyrightconfig.json
|
| 172 |
+
|
| 173 |
+
### Node ###
|
| 174 |
+
# Logs
|
| 175 |
+
logs
|
| 176 |
+
*.log
|
| 177 |
+
npm-debug.log*
|
| 178 |
+
yarn-debug.log*
|
| 179 |
+
yarn-error.log*
|
| 180 |
+
lerna-debug.log*
|
| 181 |
+
.pnpm-debug.log*
|
| 182 |
+
|
| 183 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
| 184 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
| 185 |
+
|
| 186 |
+
# Runtime data
|
| 187 |
+
pids
|
| 188 |
+
*.pid
|
| 189 |
+
*.seed
|
| 190 |
+
*.pid.lock
|
| 191 |
+
|
| 192 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
| 193 |
+
lib-cov
|
| 194 |
+
|
| 195 |
+
# Coverage directory used by tools like istanbul
|
| 196 |
+
coverage
|
| 197 |
+
*.lcov
|
| 198 |
+
|
| 199 |
+
# nyc test coverage
|
| 200 |
+
.nyc_output
|
| 201 |
+
|
| 202 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
| 203 |
+
.grunt
|
| 204 |
+
|
| 205 |
+
# Bower dependency directory (https://bower.io/)
|
| 206 |
+
bower_components
|
| 207 |
+
|
| 208 |
+
# node-waf configuration
|
| 209 |
+
.lock-wscript
|
| 210 |
+
|
| 211 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
| 212 |
+
build/Release
|
| 213 |
+
|
| 214 |
+
# Dependency directories
|
| 215 |
+
node_modules/
|
| 216 |
+
jspm_packages/
|
| 217 |
+
|
| 218 |
+
# Snowpack dependency directory (https://snowpack.dev/)
|
| 219 |
+
web_modules/
|
| 220 |
+
|
| 221 |
+
# TypeScript cache
|
| 222 |
+
*.tsbuildinfo
|
| 223 |
+
|
| 224 |
+
# Optional npm cache directory
|
| 225 |
+
.npm
|
| 226 |
+
|
| 227 |
+
# Optional eslint cache
|
| 228 |
+
.eslintcache
|
| 229 |
+
|
| 230 |
+
# Optional stylelint cache
|
| 231 |
+
.stylelintcache
|
| 232 |
+
|
| 233 |
+
# Microbundle cache
|
| 234 |
+
.rpt2_cache/
|
| 235 |
+
.rts2_cache_cjs/
|
| 236 |
+
.rts2_cache_es/
|
| 237 |
+
.rts2_cache_umd/
|
| 238 |
+
|
| 239 |
+
# Optional REPL history
|
| 240 |
+
.node_repl_history
|
| 241 |
+
|
| 242 |
+
# Output of 'npm pack'
|
| 243 |
+
*.tgz
|
| 244 |
+
|
| 245 |
+
# Yarn Integrity file
|
| 246 |
+
.yarn-integrity
|
| 247 |
+
|
| 248 |
+
# dotenv environment variable files
|
| 249 |
+
.env
|
| 250 |
+
.env.development.local
|
| 251 |
+
.env.test.local
|
| 252 |
+
.env.production.local
|
| 253 |
+
.env.local
|
| 254 |
+
|
| 255 |
+
# parcel-bundler cache (https://parceljs.org/)
|
| 256 |
+
.cache
|
| 257 |
+
.parcel-cache
|
| 258 |
+
|
| 259 |
+
# Next.js build output
|
| 260 |
+
.next
|
| 261 |
+
out
|
| 262 |
+
|
| 263 |
+
# Nuxt.js build / generate output
|
| 264 |
+
.nuxt
|
| 265 |
+
dist
|
| 266 |
+
|
| 267 |
+
# Gatsby files
|
| 268 |
+
.cache/
|
| 269 |
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
| 270 |
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
| 271 |
+
# public
|
| 272 |
+
|
| 273 |
+
# vuepress build output
|
| 274 |
+
.vuepress/dist
|
| 275 |
+
|
| 276 |
+
# vuepress v2.x temp and cache directory
|
| 277 |
+
.temp
|
| 278 |
+
|
| 279 |
+
# Docusaurus cache and generated files
|
| 280 |
+
.docusaurus
|
| 281 |
+
|
| 282 |
+
# Serverless directories
|
| 283 |
+
.serverless/
|
| 284 |
+
|
| 285 |
+
# FuseBox cache
|
| 286 |
+
.fusebox/
|
| 287 |
+
|
| 288 |
+
# DynamoDB Local files
|
| 289 |
+
.dynamodb/
|
| 290 |
+
|
| 291 |
+
# TernJS port file
|
| 292 |
+
.tern-port
|
| 293 |
+
|
| 294 |
+
# Stores VSCode versions used for testing VSCode extensions
|
| 295 |
+
.vscode-test
|
| 296 |
+
|
| 297 |
+
# yarn v2
|
| 298 |
+
.yarn/cache
|
| 299 |
+
.yarn/unplugged
|
| 300 |
+
.yarn/build-state.yml
|
| 301 |
+
.yarn/install-state.gz
|
| 302 |
+
.pnp.*
|
| 303 |
+
|
| 304 |
+
### Node Patch ###
|
| 305 |
+
# Serverless Webpack directories
|
| 306 |
+
.webpack/
|
| 307 |
+
|
| 308 |
+
# Optional stylelint cache
|
| 309 |
+
|
| 310 |
+
# SvelteKit build / generate output
|
| 311 |
+
.svelte-kit
|
Dockerfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.8-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /usr/src/app
|
| 4 |
+
COPY . .
|
| 5 |
+
RUN pip install -r requirements.txt
|
| 6 |
+
EXPOSE 7860
|
| 7 |
+
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 8 |
+
|
| 9 |
+
CMD ["python", "app.py"]
|
README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Replicant Network Chat
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.24.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
short_description: 'Join the network at: https://replicantzk.com.'
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference.
|
app.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from openai import AsyncOpenAI
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
client = AsyncOpenAI()
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
async def predict(message, history, model, temperature):
|
| 8 |
+
history_openai_format = []
|
| 9 |
+
for human, assistant in history:
|
| 10 |
+
history_openai_format.append({"role": "user", "content": human})
|
| 11 |
+
history_openai_format.append({"role": "assistant", "content": assistant})
|
| 12 |
+
history_openai_format.append({"role": "user", "content": message})
|
| 13 |
+
|
| 14 |
+
response = await client.chat.completions.create(
|
| 15 |
+
model=model,
|
| 16 |
+
messages=history_openai_format,
|
| 17 |
+
temperature=temperature,
|
| 18 |
+
stream=True,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
partial_message = ""
|
| 22 |
+
async for chunk in response:
|
| 23 |
+
if chunk.choices[0].delta.content is not None:
|
| 24 |
+
partial_message += chunk.choices[0].delta.content
|
| 25 |
+
yield partial_message
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
model_dropdown = gr.Dropdown(
|
| 29 |
+
label="Model",
|
| 30 |
+
choices=[
|
| 31 |
+
"qwen:0.5b-chat-v1.5-q4_K_M",
|
| 32 |
+
"llama3:8b-instruct-q4_K_M",
|
| 33 |
+
"phind-codellama:34b-v2-q4_K_M",
|
| 34 |
+
],
|
| 35 |
+
value="llama3:8b-instruct-q4_K_M",
|
| 36 |
+
)
|
| 37 |
+
temperature_slider = gr.Slider(0, 1, value=0, label="Temperature")
|
| 38 |
+
api_key = gr.Textbox(label="OpenAI API Key")
|
| 39 |
+
|
| 40 |
+
desc = "Join the network at: https://replicantzk.com."
|
| 41 |
+
|
| 42 |
+
gr.ChatInterface(
|
| 43 |
+
predict, additional_inputs=[model_dropdown, temperature_slider], description=desc
|
| 44 |
+
).launch()
|
poetry.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pyproject.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[tool.poetry]
|
| 2 |
+
name = "chat"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = ""
|
| 5 |
+
authors = []
|
| 6 |
+
readme = "README.md"
|
| 7 |
+
package-mode = false
|
| 8 |
+
|
| 9 |
+
[tool.poetry.dependencies]
|
| 10 |
+
python = "^3.10"
|
| 11 |
+
gradio = "4.24.0"
|
| 12 |
+
openai = "1.14.3"
|
| 13 |
+
|
| 14 |
+
[build-system]
|
| 15 |
+
requires = ["poetry-core"]
|
| 16 |
+
build-backend = "poetry.core.masonry.api"
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.24.0
|
| 2 |
+
openai==1.14.3
|
sh/reqs.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/sh
|
| 2 |
+
|
| 3 |
+
poetry export -f requirements.txt --output requirements.txt
|
sh/start.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/sh
|
| 2 |
+
|
| 3 |
+
poetry run python ./app.py
|