kiptoozeff commited on
Commit
f00078d
β€’
1 Parent(s): d1e14ae

Upload 5 files

Browse files
Files changed (5) hide show
  1. .gitattributes +3 -10
  2. .gitignore +518 -0
  3. README.md +31 -7
  4. app.py +44 -0
  5. requirements.txt +3 -0
.gitattributes CHANGED
@@ -1,35 +1,28 @@
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
 
 
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
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
  *.bz2 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
  *.model filter=lfs diff=lfs merge=lfs -text
12
  *.msgpack filter=lfs diff=lfs merge=lfs -text
 
 
13
  *.onnx filter=lfs diff=lfs merge=lfs -text
14
  *.ot filter=lfs diff=lfs merge=lfs -text
15
  *.parquet filter=lfs diff=lfs merge=lfs -text
16
  *.pb filter=lfs diff=lfs merge=lfs -text
 
 
17
  *.pt filter=lfs diff=lfs merge=lfs -text
18
  *.pth filter=lfs diff=lfs merge=lfs -text
19
  *.rar filter=lfs diff=lfs merge=lfs -text
 
20
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
  *.tar.* filter=lfs diff=lfs merge=lfs -text
 
22
  *.tflite filter=lfs diff=lfs merge=lfs -text
23
  *.tgz filter=lfs diff=lfs merge=lfs -text
 
24
  *.xz filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ *.json filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,518 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ ### JetBrains template
3
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
4
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
5
+
6
+ .idea/
7
+ # User-specific stuff
8
+ .idea/**/workspace.xml
9
+ .idea/**/tasks.xml
10
+ .idea/**/usage.statistics.xml
11
+ .idea/**/dictionaries
12
+ .idea/**/shelf
13
+
14
+ # Sensitive or high-churn files
15
+ .idea/**/dataSources/
16
+ .idea/**/dataSources.ids
17
+ .idea/**/dataSources.local.xml
18
+ .idea/**/sqlDataSources.xml
19
+ .idea/**/dynamic.xml
20
+ .idea/**/uiDesigner.xml
21
+ .idea/**/dbnavigator.xml
22
+
23
+ # Gradle
24
+ .idea/**/gradle.xml
25
+ .idea/**/libraries
26
+
27
+ # Gradle and Maven with auto-import
28
+ # When using Gradle or Maven with auto-import, you should exclude module files,
29
+ # since they will be recreated, and may cause churn. Uncomment if using
30
+ # auto-import.
31
+ # .idea/modules.xml
32
+ # .idea/*.iml
33
+ # .idea/modules
34
+
35
+ # CMake
36
+ cmake-build-*/
37
+
38
+ # Mongo Explorer plugin
39
+ .idea/**/mongoSettings.xml
40
+
41
+ # File-based project format
42
+ *.iws
43
+
44
+ # IntelliJ
45
+ out/
46
+
47
+ # mpeltonen/sbt-idea plugin
48
+ .idea_modules/
49
+
50
+ # JIRA plugin
51
+ atlassian-ide-plugin.xml
52
+
53
+ # Cursive Clojure plugin
54
+ .idea/replstate.xml
55
+
56
+ # Crashlytics plugin (for Android Studio and IntelliJ)
57
+ com_crashlytics_export_strings.xml
58
+ crashlytics.properties
59
+ crashlytics-build.properties
60
+ fabric.properties
61
+
62
+ # Editor-based Rest Client
63
+ .idea/httpRequests
64
+ ### VirtualEnv template
65
+ # Virtualenv
66
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
67
+ .Python
68
+ [Bb]in
69
+ [Ii]nclude
70
+ [Ll]ib
71
+ [Ll]ib64
72
+ [Ll]ocal
73
+ [Ss]cripts
74
+ pyvenv.cfg
75
+ .venv
76
+ pip-selfcheck.json
77
+ ### VisualStudio template
78
+ ## Ignore Visual Studio temporary files, build results, and
79
+ ## files generated by popular Visual Studio add-ons.
80
+ ##
81
+ ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
82
+
83
+ # User-specific files
84
+ *.suo
85
+ *.user
86
+ *.userosscache
87
+ *.sln.docstates
88
+
89
+ # User-specific files (MonoDevelop/Xamarin Studio)
90
+ *.userprefs
91
+
92
+ # Build results
93
+ [Dd]ebug/
94
+ [Dd]ebugPublic/
95
+ [Rr]elease/
96
+ [Rr]eleases/
97
+ x64/
98
+ x86/
99
+ bld/
100
+ [Bb]in/
101
+ [Oo]bj/
102
+ [Ll]og/
103
+
104
+ # Visual Studio 2015/2017 cache/options directory
105
+ .vs/
106
+ # Uncomment if you have tasks that create the project's static files in wwwroot
107
+ #wwwroot/
108
+
109
+ # Visual Studio 2017 auto generated files
110
+ Generated\ Files/
111
+
112
+ # MSTest test Results
113
+ [Tt]est[Rr]esult*/
114
+ [Bb]uild[Ll]og.*
115
+
116
+ # NUNIT
117
+ *.VisualState.xml
118
+ TestResult.xml
119
+
120
+ # Build Results of an ATL Project
121
+ [Dd]ebugPS/
122
+ [Rr]eleasePS/
123
+ dlldata.c
124
+
125
+ # Benchmark Results
126
+ BenchmarkDotNet.Artifacts/
127
+
128
+ # .NET Core
129
+ project.lock.json
130
+ project.fragment.lock.json
131
+ artifacts/
132
+
133
+ # StyleCop
134
+ StyleCopReport.xml
135
+
136
+ # Files built by Visual Studio
137
+ *_i.c
138
+ *_p.c
139
+ *_i.h
140
+ *.ilk
141
+ *.meta
142
+ *.obj
143
+ *.iobj
144
+ *.pch
145
+ *.pdb
146
+ *.ipdb
147
+ *.pgc
148
+ *.pgd
149
+ *.rsp
150
+ *.sbr
151
+ *.tlb
152
+ *.tli
153
+ *.tlh
154
+ *.tmp
155
+ *.tmp_proj
156
+ *.log
157
+ *.vspscc
158
+ *.vssscc
159
+ .builds
160
+ *.pidb
161
+ *.svclog
162
+ *.scc
163
+
164
+ # Chutzpah Test files
165
+ _Chutzpah*
166
+
167
+ # Visual C++ cache files
168
+ ipch/
169
+ *.aps
170
+ *.ncb
171
+ *.opendb
172
+ *.opensdf
173
+ *.sdf
174
+ *.cachefile
175
+ *.VC.db
176
+ *.VC.VC.opendb
177
+
178
+ # Visual Studio profiler
179
+ *.psess
180
+ *.vsp
181
+ *.vspx
182
+ *.sap
183
+
184
+ # Visual Studio Trace Files
185
+ *.e2e
186
+
187
+ # TFS 2012 Local Workspace
188
+ $tf/
189
+
190
+ # Guidance Automation Toolkit
191
+ *.gpState
192
+
193
+ # ReSharper is a .NET coding add-in
194
+ _ReSharper*/
195
+ *.[Rr]e[Ss]harper
196
+ *.DotSettings.user
197
+
198
+ # JustCode is a .NET coding add-in
199
+ .JustCode
200
+
201
+ # TeamCity is a build add-in
202
+ _TeamCity*
203
+
204
+ # DotCover is a Code Coverage Tool
205
+ *.dotCover
206
+
207
+ # AxoCover is a Code Coverage Tool
208
+ .axoCover/*
209
+ !.axoCover/settings.json
210
+
211
+ # Visual Studio code coverage results
212
+ *.coverage
213
+ *.coveragexml
214
+
215
+ # NCrunch
216
+ _NCrunch_*
217
+ .*crunch*.local.xml
218
+ nCrunchTemp_*
219
+
220
+ # MightyMoose
221
+ *.mm.*
222
+ AutoTest.Net/
223
+
224
+ # Web workbench (sass)
225
+ .sass-cache/
226
+
227
+ # Installshield output folder
228
+ [Ee]xpress/
229
+
230
+ # DocProject is a documentation generator add-in
231
+ DocProject/buildhelp/
232
+ DocProject/Help/*.HxT
233
+ DocProject/Help/*.HxC
234
+ DocProject/Help/*.hhc
235
+ DocProject/Help/*.hhk
236
+ DocProject/Help/*.hhp
237
+ DocProject/Help/Html2
238
+ DocProject/Help/html
239
+
240
+ # Click-Once directory
241
+ publish/
242
+
243
+ # Publish Web Output
244
+ *.[Pp]ublish.xml
245
+ *.azurePubxml
246
+ # Note: Comment the next line if you want to checkin your web deploy settings,
247
+ # but database connection strings (with potential passwords) will be unencrypted
248
+ *.pubxml
249
+ *.publishproj
250
+
251
+ # Microsoft Azure Web App publish settings. Comment the next line if you want to
252
+ # checkin your Azure Web App publish settings, but sensitive information contained
253
+ # in these scripts will be unencrypted
254
+ PublishScripts/
255
+
256
+ # NuGet Packages
257
+ *.nupkg
258
+ # The packages folder can be ignored because of Package Restore
259
+ **/[Pp]ackages/*
260
+ # except build/, which is used as an MSBuild target.
261
+ !**/[Pp]ackages/build/
262
+ # Uncomment if necessary however generally it will be regenerated when needed
263
+ #!**/[Pp]ackages/repositories.config
264
+ # NuGet v3's project.json files produces more ignorable files
265
+ *.nuget.props
266
+ *.nuget.targets
267
+
268
+ # Microsoft Azure Build Output
269
+ csx/
270
+ *.build.csdef
271
+
272
+ # Microsoft Azure Emulator
273
+ ecf/
274
+ rcf/
275
+
276
+ # Windows Store app package directories and files
277
+ AppPackages/
278
+ BundleArtifacts/
279
+ Package.StoreAssociation.xml
280
+ _pkginfo.txt
281
+ *.appx
282
+
283
+ # Visual Studio cache files
284
+ # files ending in .cache can be ignored
285
+ *.[Cc]ache
286
+ # but keep track of directories ending in .cache
287
+ !*.[Cc]ache/
288
+
289
+ # Others
290
+ ClientBin/
291
+ ~$*
292
+ *~
293
+ *.dbmdl
294
+ *.dbproj.schemaview
295
+ *.jfm
296
+ *.pfx
297
+ *.publishsettings
298
+ orleans.codegen.cs
299
+
300
+ # Including strong name files can present a security risk
301
+ # (https://github.com/github/gitignore/pull/2483#issue-259490424)
302
+ #*.snk
303
+
304
+ # Since there are multiple workflows, uncomment next line to ignore bower_components
305
+ # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
306
+ #bower_components/
307
+
308
+ # RIA/Silverlight projects
309
+ Generated_Code/
310
+
311
+ # Backup & report files from converting an old project file
312
+ # to a newer Visual Studio version. Backup files are not needed,
313
+ # because we have git ;-)
314
+ _UpgradeReport_Files/
315
+ Backup*/
316
+ UpgradeLog*.XML
317
+ UpgradeLog*.htm
318
+ ServiceFabricBackup/
319
+ *.rptproj.bak
320
+
321
+ # SQL Server files
322
+ *.mdf
323
+ *.ldf
324
+ *.ndf
325
+
326
+ # Business Intelligence projects
327
+ *.rdl.data
328
+ *.bim.layout
329
+ *.bim_*.settings
330
+ *.rptproj.rsuser
331
+
332
+ # Microsoft Fakes
333
+ FakesAssemblies/
334
+
335
+ # GhostDoc plugin setting file
336
+ *.GhostDoc.xml
337
+
338
+ # Node.js Tools for Visual Studio
339
+ .ntvs_analysis.dat
340
+ node_modules/
341
+
342
+ # Visual Studio 6 build log
343
+ *.plg
344
+
345
+ # Visual Studio 6 workspace options file
346
+ *.opt
347
+
348
+ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
349
+ *.vbw
350
+
351
+ # Visual Studio LightSwitch build output
352
+ **/*.HTMLClient/GeneratedArtifacts
353
+ **/*.DesktopClient/GeneratedArtifacts
354
+ **/*.DesktopClient/ModelManifest.xml
355
+ **/*.Server/GeneratedArtifacts
356
+ **/*.Server/ModelManifest.xml
357
+ _Pvt_Extensions
358
+
359
+ # Paket dependency manager
360
+ .paket/paket.exe
361
+ paket-files/
362
+
363
+ # FAKE - F# Make
364
+ .fake/
365
+
366
+ # JetBrains Rider
367
+ .idea/
368
+ *.sln.iml
369
+
370
+ # CodeRush
371
+ .cr/
372
+
373
+ # Python Tools for Visual Studio (PTVS)
374
+ __pycache__/
375
+ *.pyc
376
+
377
+ # Cake - Uncomment if you are using it
378
+ # tools/**
379
+ # !tools/packages.config
380
+
381
+ # Tabs Studio
382
+ *.tss
383
+
384
+ # Telerik's JustMock configuration file
385
+ *.jmconfig
386
+
387
+ # BizTalk build output
388
+ *.btp.cs
389
+ *.btm.cs
390
+ *.odx.cs
391
+ *.xsd.cs
392
+
393
+ # OpenCover UI analysis results
394
+ OpenCover/
395
+
396
+ # Azure Stream Analytics local run output
397
+ ASALocalRun/
398
+
399
+ # MSBuild Binary and Structured Log
400
+ *.binlog
401
+
402
+ # NVidia Nsight GPU debugger configuration file
403
+ *.nvuser
404
+
405
+ # MFractors (Xamarin productivity tool) working folder
406
+ .mfractor/
407
+ ### Python template
408
+ # Byte-compiled / optimized / DLL files
409
+ __pycache__/
410
+ *.py[cod]
411
+ *$py.class
412
+
413
+ # C extensions
414
+ *.so
415
+
416
+ # Distribution / packaging
417
+ .Python
418
+ build/
419
+ develop-eggs/
420
+ dist/
421
+ downloads/
422
+ eggs/
423
+ .eggs/
424
+ lib64/
425
+ parts/
426
+ sdist/
427
+ var/
428
+ wheels/
429
+ *.egg-info/
430
+ .installed.cfg
431
+ *.egg
432
+ MANIFEST
433
+
434
+ # PyInstaller
435
+ # Usually these files are written by a python script from a template
436
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
437
+ *.manifest
438
+ *.spec
439
+
440
+ # Installer logs
441
+ pip-log.txt
442
+ pip-delete-this-directory.txt
443
+
444
+ # Unit test / coverage reports
445
+ htmlcov/
446
+ .tox/
447
+ .coverage
448
+ .coverage.*
449
+ .cache
450
+ nosetests.xml
451
+ coverage.xml
452
+ *.cover
453
+ .hypothesis/
454
+ .pytest_cache/
455
+
456
+ # Translations
457
+ *.mo
458
+ *.pot
459
+
460
+ # Django stuff:
461
+ *.log
462
+ local_settings.py
463
+ db.sqlite3
464
+
465
+ # Flask stuff:
466
+ instance/
467
+ .webassets-cache
468
+
469
+ # Scrapy stuff:
470
+ .scrapy
471
+
472
+ # Sphinx documentation
473
+ docs/_build/
474
+
475
+ # PyBuilder
476
+ target/
477
+
478
+ # Jupyter Notebook
479
+ .ipynb_checkpoints
480
+
481
+ # pyenv
482
+ .python-version
483
+
484
+ # celery beat schedule file
485
+ celerybeat-schedule
486
+
487
+ # SageMath parsed files
488
+ *.sage.py
489
+
490
+ # Environments
491
+ .env
492
+ .venv
493
+ env/
494
+ venv/
495
+ ENV/
496
+ env.bak/
497
+ venv.bak/
498
+
499
+ # Spyder project settings
500
+ .spyderproject
501
+ .spyproject
502
+
503
+ # Rope project settings
504
+ .ropeproject
505
+
506
+ # mkdocs documentation
507
+ /site
508
+
509
+ # mypy
510
+ .mypy_cache/
511
+ data/dataframes/*
512
+ jobs.sqlite
513
+ result.txt
514
+ *.log
515
+ data/raw/*
516
+ notebooks
517
+ face_db/*.txt
518
+ face_db/*.npy
README.md CHANGED
@@ -1,13 +1,37 @@
1
  ---
2
- title: Tweet Sentiment Analysis
3
- emoji: πŸƒ
4
- colorFrom: gray
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.22.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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Twitter_emotions
3
+ emoji: πŸš€
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: gradio
 
7
  app_file: app.py
8
  pinned: false
 
9
  ---
10
 
11
+ # Configuration
12
+
13
+ `title`: _string_
14
+ Display title for the Space
15
+
16
+ `emoji`: _string_
17
+ Space emoji (emoji-only character allowed)
18
+
19
+ `colorFrom`: _string_
20
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
+
22
+ `colorTo`: _string_
23
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
+
25
+ `sdk`: _string_
26
+ Can be either `gradio` or `streamlit`
27
+
28
+ `sdk_version` : _string_
29
+ Only applicable for `streamlit` SDK.
30
+ See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
+
32
+ `app_file`: _string_
33
+ Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
+ Path is relative to the root of the repository.
35
+
36
+ `pinned`: _boolean_
37
+ Whether the Space stays on top of your list.
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from transformers import AutoModelForSequenceClassification
4
+ from transformers import AutoTokenizer
5
+ from transformers import pipeline
6
+
7
+ model_path = "trnt/twitter_emotions"
8
+ is_gpu = False
9
+ device = torch.device('cuda') if is_gpu else torch.device('cpu')
10
+ print(device)
11
+ model = AutoModelForSequenceClassification.from_pretrained(model_path)
12
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
13
+ model.to(device)
14
+ model.eval()
15
+ print("Model was loaded")
16
+
17
+ classifier = pipeline("text-classification", model=model, tokenizer=tokenizer, device=is_gpu-1)
18
+ emotions = {'LABEL_0': 'sadness', 'LABEL_1': 'joy', 'LABEL_2': 'love', 'LABEL_3': 'anger', 'LABEL_4': 'fear',
19
+ 'LABEL_5': 'surprise'}
20
+ examples = ["I love you!", "I hate you!"]
21
+
22
+
23
+ def predict(twitter):
24
+ pred = classifier(twitter, return_all_scores=True)[0]
25
+ res = {"Sadness": pred[0]["score"],
26
+ "Joy": pred[1]["score"],
27
+ "Love": pred[2]["score"],
28
+ "Anger": pred[3]["score"],
29
+ "Fear": pred[4]["score"],
30
+ "Surprise": pred[5]["score"]}
31
+ # "This tweet is %s with probability=%.2f" % (emotions[pred['label']], 100 * pred['score']) + "%"
32
+ return res
33
+
34
+
35
+ if __name__ == '__main__':
36
+ interFace = gr.Interface(fn=predict,
37
+ inputs=gr.inputs.Textbox(placeholder="Enter a tweet here", label="Tweet content", lines=5),
38
+ outputs=gr.outputs.Label(num_top_classes=6, label="Emotions of this tweet is "),
39
+ verbose=True,
40
+ examples=examples,
41
+ title="Emotions of English tweet",
42
+ description="",
43
+ theme="grass")
44
+ interFace.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ gradio
3
+ torch