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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
app.py CHANGED
@@ -1,26 +1,21 @@
1
  import gradio as gr
2
-
3
- from datasets import load_dataset
4
- from transformers import AutoTokenizer, DataCollatorWithPadding
5
- from transformers import TrainingArguments
6
  from transformers import AutoModelForSequenceClassification
7
- from transformers import Trainer
8
- from datasets import load_metric
9
- import numpy as np
10
  from transformers import pipeline
11
 
12
-
13
  model_loader = AutoModelForSequenceClassification.from_pretrained("content/models")
14
  tokenizer_loader = AutoTokenizer.from_pretrained("content/models")
15
  model_loader.eval()
16
  print("loaded")
17
 
18
-
19
  classifier = pipeline("sentiment-analysis", model=model_loader, tokenizer=tokenizer_loader, device=0)
20
 
 
21
  def greet(twitter):
22
  pred = classifier(twitter)[0]
23
  return "twitter is %s with score=%.4f" % (pred['label'], pred['score'])
24
 
25
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
26
- iface.launch()
 
 
 
1
  import gradio as gr
 
 
 
 
2
  from transformers import AutoModelForSequenceClassification
3
+ from transformers import AutoTokenizer
 
 
4
  from transformers import pipeline
5
 
 
6
  model_loader = AutoModelForSequenceClassification.from_pretrained("content/models")
7
  tokenizer_loader = AutoTokenizer.from_pretrained("content/models")
8
  model_loader.eval()
9
  print("loaded")
10
 
 
11
  classifier = pipeline("sentiment-analysis", model=model_loader, tokenizer=tokenizer_loader, device=0)
12
 
13
+
14
  def greet(twitter):
15
  pred = classifier(twitter)[0]
16
  return "twitter is %s with score=%.4f" % (pred['label'], pred['score'])
17
 
18
+
19
+ if __name__ == '__main__':
20
+ interFace = gr.Interface(fn=greet, inputs="text", outputs="text")
21
+ interFace.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ gradio