m3hrdadfi commited on
Commit
ac6bfa9
1 Parent(s): 81093cc

Reprogramm demo

Browse files
.gitignore CHANGED
@@ -1,4 +1,887 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  __pycache__/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  .idea
3
  .DS_Store
4
  .DS_store
 
 
 
1
+ ### TeX template
2
+ ## Core latex/pdflatex auxiliary files:
3
+ *.aux
4
+ *.lof
5
+ *.log
6
+ *.lot
7
+ *.fls
8
+ *.out
9
+ *.toc
10
+ *.fmt
11
+ *.fot
12
+ *.cb
13
+ *.cb2
14
+ .*.lb
15
+
16
+ ## Intermediate documents:
17
+ *.dvi
18
+ *.xdv
19
+ *-converted-to.*
20
+ # these rules might exclude image files for figures etc.
21
+ # *.ps
22
+ # *.eps
23
+ # *.pdf
24
+
25
+ ## Generated if empty string is given at "Please type another file name for output:"
26
+ .pdf
27
+
28
+ ## Bibliography auxiliary files (bibtex/biblatex/biber):
29
+ *.bbl
30
+ *.bcf
31
+ *.blg
32
+ *-blx.aux
33
+ *-blx.bib
34
+ *.run.xml
35
+
36
+ ## Build tool auxiliary files:
37
+ *.fdb_latexmk
38
+ *.synctex
39
+ *.synctex(busy)
40
+ *.synctex.gz
41
+ *.synctex.gz(busy)
42
+ *.pdfsync
43
+
44
+ ## Build tool directories for auxiliary files
45
+ # latexrun
46
+ latex.out/
47
+
48
+ ## Auxiliary and intermediate files from other packages:
49
+ # algorithms
50
+ *.alg
51
+ *.loa
52
+
53
+ # achemso
54
+ acs-*.bib
55
+
56
+ # amsthm
57
+ *.thm
58
+
59
+ # beamer
60
+ *.nav
61
+ *.pre
62
+ *.snm
63
+ *.vrb
64
+
65
+ # changes
66
+ *.soc
67
+
68
+ # comment
69
+ *.cut
70
+
71
+ # cprotect
72
+ *.cpt
73
+
74
+ # elsarticle (documentclass of Elsevier journals)
75
+ *.spl
76
+
77
+ # endnotes
78
+ *.ent
79
+
80
+ # fixme
81
+ *.lox
82
+
83
+ # feynmf/feynmp
84
+ *.mf
85
+ *.mp
86
+ *.t[1-9]
87
+ *.t[1-9][0-9]
88
+ *.tfm
89
+
90
+ #(r)(e)ledmac/(r)(e)ledpar
91
+ *.end
92
+ *.?end
93
+ *.[1-9]
94
+ *.[1-9][0-9]
95
+ *.[1-9][0-9][0-9]
96
+ *.[1-9]R
97
+ *.[1-9][0-9]R
98
+ *.[1-9][0-9][0-9]R
99
+ *.eledsec[1-9]
100
+ *.eledsec[1-9]R
101
+ *.eledsec[1-9][0-9]
102
+ *.eledsec[1-9][0-9]R
103
+ *.eledsec[1-9][0-9][0-9]
104
+ *.eledsec[1-9][0-9][0-9]R
105
+
106
+ # glossaries
107
+ *.acn
108
+ *.acr
109
+ *.glg
110
+ *.glo
111
+ *.gls
112
+ *.glsdefs
113
+ *.lzo
114
+ *.lzs
115
+
116
+ # uncomment this for glossaries-extra (will ignore makeindex's style files!)
117
+ # *.ist
118
+
119
+ # gnuplottex
120
+ *-gnuplottex-*
121
+
122
+ # gregoriotex
123
+ *.gaux
124
+ *.gtex
125
+
126
+ # htlatex
127
+ *.4ct
128
+ *.4tc
129
+ *.idv
130
+ *.lg
131
+ *.trc
132
+ *.xref
133
+
134
+ # hyperref
135
+ *.brf
136
+
137
+ # knitr
138
+ *-concordance.tex
139
+ # TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
140
+ # *.tikz
141
+ *-tikzDictionary
142
+
143
+ # listings
144
+ *.lol
145
+
146
+ # luatexja-ruby
147
+ *.ltjruby
148
+
149
+ # makeidx
150
+ *.idx
151
+ *.ilg
152
+ *.ind
153
+
154
+ # minitoc
155
+ *.maf
156
+ *.mlf
157
+ *.mlt
158
+ *.mtc[0-9]*
159
+ *.slf[0-9]*
160
+ *.slt[0-9]*
161
+ *.stc[0-9]*
162
+
163
+ # minted
164
+ _minted*
165
+ *.pyg
166
+
167
+ # morewrites
168
+ *.mw
169
+
170
+ # nomencl
171
+ *.nlg
172
+ *.nlo
173
+ *.nls
174
+
175
+ # pax
176
+ *.pax
177
+
178
+ # pdfpcnotes
179
+ *.pdfpc
180
+
181
+ # sagetex
182
+ *.sagetex.sage
183
+ *.sagetex.py
184
+ *.sagetex.scmd
185
+
186
+ # scrwfile
187
+ *.wrt
188
+
189
+ # sympy
190
+ *.sout
191
+ *.sympy
192
+ sympy-plots-for-*.tex/
193
+
194
+ # pdfcomment
195
+ *.upa
196
+ *.upb
197
+
198
+ # pythontex
199
+ *.pytxcode
200
+ pythontex-files-*/
201
+
202
+ # tcolorbox
203
+ *.listing
204
+
205
+ # thmtools
206
+ *.loe
207
+
208
+ # TikZ & PGF
209
+ *.dpth
210
+ *.md5
211
+ *.auxlock
212
+
213
+ # todonotes
214
+ *.tdo
215
+
216
+ # vhistory
217
+ *.hst
218
+ *.ver
219
+
220
+ # easy-todo
221
+ *.lod
222
+
223
+ # xcolor
224
+ *.xcp
225
+
226
+ # xmpincl
227
+ *.xmpi
228
+
229
+ # xindy
230
+ *.xdy
231
+
232
+ # xypic precompiled matrices and outlines
233
+ *.xyc
234
+ *.xyd
235
+
236
+ # endfloat
237
+ *.ttt
238
+ *.fff
239
+
240
+ # Latexian
241
+ TSWLatexianTemp*
242
+
243
+ ## Editors:
244
+ # WinEdt
245
+ *.bak
246
+ *.sav
247
+
248
+ # Texpad
249
+ .texpadtmp
250
+
251
+ # LyX
252
+ *.lyx~
253
+
254
+ # Kile
255
+ *.backup
256
+
257
+ # gummi
258
+ .*.swp
259
+
260
+ # KBibTeX
261
+ *~[0-9]*
262
+
263
+ # TeXnicCenter
264
+ *.tps
265
+
266
+ # auto folder when using emacs and auctex
267
+ ./auto/*
268
+ *.el
269
+
270
+ # expex forward references with \gathertags
271
+ *-tags.tex
272
+
273
+ # standalone packages
274
+ *.sta
275
+
276
+ # Makeindex log files
277
+ *.lpz
278
+
279
+ # xwatermark package
280
+ *.xwm
281
+
282
+ # REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
283
+ # option is specified. Footnotes are the stored in a file with suffix Notes.bib.
284
+ # Uncomment the next line to have this generated file ignored.
285
+ #*Notes.bib
286
+
287
+ ### VisualStudio template
288
+ ## Ignore Visual Studio temporary files, build results, and
289
+ ## files generated by popular Visual Studio add-ons.
290
+ ##
291
+ ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
292
+
293
+ # User-specific files
294
+ *.rsuser
295
+ *.suo
296
+ *.user
297
+ *.userosscache
298
+ *.sln.docstates
299
+
300
+ # User-specific files (MonoDevelop/Xamarin Studio)
301
+ *.userprefs
302
+
303
+ # Mono auto generated files
304
+ mono_crash.*
305
+
306
+ # Build results
307
+ [Dd]ebug/
308
+ [Dd]ebugPublic/
309
+ [Rr]elease/
310
+ [Rr]eleases/
311
+ x64/
312
+ x86/
313
+ [Ww][Ii][Nn]32/
314
+ [Aa][Rr][Mm]/
315
+ [Aa][Rr][Mm]64/
316
+ bld/
317
+ [Bb]in/
318
+ [Oo]bj/
319
+ [Ll]og/
320
+ [Ll]ogs/
321
+
322
+ # Visual Studio 2015/2017 cache/options directory
323
+ .vs/
324
+ # Uncomment if you have tasks that create the project's static files in wwwroot
325
+ #wwwroot/
326
+
327
+ # Visual Studio 2017 auto generated files
328
+ Generated\ Files/
329
+
330
+ # MSTest test Results
331
+ [Tt]est[Rr]esult*/
332
+ [Bb]uild[Ll]og.*
333
+
334
+ # NUnit
335
+ *.VisualState.xml
336
+ TestResult.xml
337
+ nunit-*.xml
338
+
339
+ # Build Results of an ATL Project
340
+ [Dd]ebugPS/
341
+ [Rr]eleasePS/
342
+ dlldata.c
343
+
344
+ # Benchmark Results
345
+ BenchmarkDotNet.Artifacts/
346
+
347
+ # .NET Core
348
+ project.lock.json
349
+ project.fragment.lock.json
350
+ artifacts/
351
+
352
+ # ASP.NET Scaffolding
353
+ ScaffoldingReadMe.txt
354
+
355
+ # StyleCop
356
+ StyleCopReport.xml
357
+
358
+ # Files built by Visual Studio
359
+ *_i.c
360
+ *_p.c
361
+ *_h.h
362
+ *.ilk
363
+ *.meta
364
+ *.obj
365
+ *.iobj
366
+ *.pch
367
+ *.pdb
368
+ *.ipdb
369
+ *.pgc
370
+ *.pgd
371
+ *.rsp
372
+ *.sbr
373
+ *.tlb
374
+ *.tli
375
+ *.tlh
376
+ *.tmp
377
+ *.tmp_proj
378
+ *_wpftmp.csproj
379
+ *.log
380
+ *.vspscc
381
+ *.vssscc
382
+ .builds
383
+ *.pidb
384
+ *.svclog
385
+ *.scc
386
+
387
+ # Chutzpah Test files
388
+ _Chutzpah*
389
+
390
+ # Visual C++ cache files
391
+ ipch/
392
+ *.aps
393
+ *.ncb
394
+ *.opendb
395
+ *.opensdf
396
+ *.sdf
397
+ *.cachefile
398
+ *.VC.db
399
+ *.VC.VC.opendb
400
+
401
+ # Visual Studio profiler
402
+ *.psess
403
+ *.vsp
404
+ *.vspx
405
+ *.sap
406
+
407
+ # Visual Studio Trace Files
408
+ *.e2e
409
+
410
+ # TFS 2012 Local Workspace
411
+ $tf/
412
+
413
+ # Guidance Automation Toolkit
414
+ *.gpState
415
+
416
+ # ReSharper is a .NET coding add-in
417
+ _ReSharper*/
418
+ *.[Rr]e[Ss]harper
419
+ *.DotSettings.user
420
+
421
+ # TeamCity is a build add-in
422
+ _TeamCity*
423
+
424
+ # DotCover is a Code Coverage Tool
425
+ *.dotCover
426
+
427
+ # AxoCover is a Code Coverage Tool
428
+ .axoCover/*
429
+ !.axoCover/settings.json
430
+
431
+ # Coverlet is a free, cross platform Code Coverage Tool
432
+ coverage*.json
433
+ coverage*.xml
434
+ coverage*.info
435
+
436
+ # Visual Studio code coverage results
437
+ *.coverage
438
+ *.coveragexml
439
+
440
+ # NCrunch
441
+ _NCrunch_*
442
+ .*crunch*.local.xml
443
+ nCrunchTemp_*
444
+
445
+ # MightyMoose
446
+ *.mm.*
447
+ AutoTest.Net/
448
+
449
+ # Web workbench (sass)
450
+ .sass-cache/
451
+
452
+ # Installshield output folder
453
+ [Ee]xpress/
454
+
455
+ # DocProject is a documentation generator add-in
456
+ DocProject/buildhelp/
457
+ DocProject/Help/*.HxT
458
+ DocProject/Help/*.HxC
459
+ DocProject/Help/*.hhc
460
+ DocProject/Help/*.hhk
461
+ DocProject/Help/*.hhp
462
+ DocProject/Help/Html2
463
+ DocProject/Help/html
464
+
465
+ # Click-Once directory
466
+ publish/
467
+
468
+ # Publish Web Output
469
+ *.[Pp]ublish.xml
470
+ *.azurePubxml
471
+ # Note: Comment the next line if you want to checkin your web deploy settings,
472
+ # but database connection strings (with potential passwords) will be unencrypted
473
+ *.pubxml
474
+ *.publishproj
475
+
476
+ # Microsoft Azure Web App publish settings. Comment the next line if you want to
477
+ # checkin your Azure Web App publish settings, but sensitive information contained
478
+ # in these scripts will be unencrypted
479
+ PublishScripts/
480
+
481
+ # NuGet Packages
482
+ *.nupkg
483
+ # NuGet Symbol Packages
484
+ *.snupkg
485
+ # The packages folder can be ignored because of Package Restore
486
+ **/[Pp]ackages/*
487
+ # except build/, which is used as an MSBuild target.
488
+ !**/[Pp]ackages/build/
489
+ # Uncomment if necessary however generally it will be regenerated when needed
490
+ #!**/[Pp]ackages/repositories.config
491
+ # NuGet v3's project.json files produces more ignorable files
492
+ *.nuget.props
493
+ *.nuget.targets
494
+
495
+ # Microsoft Azure Build Output
496
+ csx/
497
+ *.build.csdef
498
+
499
+ # Microsoft Azure Emulator
500
+ ecf/
501
+ rcf/
502
+
503
+ # Windows Store app package directories and files
504
+ AppPackages/
505
+ BundleArtifacts/
506
+ Package.StoreAssociation.xml
507
+ _pkginfo.txt
508
+ *.appx
509
+ *.appxbundle
510
+ *.appxupload
511
+
512
+ # Visual Studio cache files
513
+ # files ending in .cache can be ignored
514
+ *.[Cc]ache
515
+ # but keep track of directories ending in .cache
516
+ !?*.[Cc]ache/
517
+
518
+ # Others
519
+ ClientBin/
520
+ ~$*
521
+ *~
522
+ *.dbmdl
523
+ *.dbproj.schemaview
524
+ *.jfm
525
+ *.pfx
526
+ *.publishsettings
527
+ orleans.codegen.cs
528
+
529
+ # Including strong name files can present a security risk
530
+ # (https://github.com/github/gitignore/pull/2483#issue-259490424)
531
+ #*.snk
532
+
533
+ # Since there are multiple workflows, uncomment next line to ignore bower_components
534
+ # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
535
+ #bower_components/
536
+
537
+ # RIA/Silverlight projects
538
+ Generated_Code/
539
+
540
+ # Backup & report files from converting an old project file
541
+ # to a newer Visual Studio version. Backup files are not needed,
542
+ # because we have git ;-)
543
+ _UpgradeReport_Files/
544
+ Backup*/
545
+ UpgradeLog*.XML
546
+ UpgradeLog*.htm
547
+ ServiceFabricBackup/
548
+ *.rptproj.bak
549
+
550
+ # SQL Server files
551
+ *.mdf
552
+ *.ldf
553
+ *.ndf
554
+
555
+ # Business Intelligence projects
556
+ *.rdl.data
557
+ *.bim.layout
558
+ *.bim_*.settings
559
+ *.rptproj.rsuser
560
+ *- [Bb]ackup.rdl
561
+ *- [Bb]ackup ([0-9]).rdl
562
+ *- [Bb]ackup ([0-9][0-9]).rdl
563
+
564
+ # Microsoft Fakes
565
+ FakesAssemblies/
566
+
567
+ # GhostDoc plugin setting file
568
+ *.GhostDoc.xml
569
+
570
+ # Node.js Tools for Visual Studio
571
+ .ntvs_analysis.dat
572
+ node_modules/
573
+
574
+ # Visual Studio 6 build log
575
+ *.plg
576
+
577
+ # Visual Studio 6 workspace options file
578
+ *.opt
579
+
580
+ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
581
+ *.vbw
582
+
583
+ # Visual Studio LightSwitch build output
584
+ **/*.HTMLClient/GeneratedArtifacts
585
+ **/*.DesktopClient/GeneratedArtifacts
586
+ **/*.DesktopClient/ModelManifest.xml
587
+ **/*.Server/GeneratedArtifacts
588
+ **/*.Server/ModelManifest.xml
589
+ _Pvt_Extensions
590
+
591
+ # Paket dependency manager
592
+ .paket/paket.exe
593
+ paket-files/
594
+
595
+ # FAKE - F# Make
596
+ .fake/
597
+
598
+ # CodeRush personal settings
599
+ .cr/personal
600
+
601
+ # Python Tools for Visual Studio (PTVS)
602
  __pycache__/
603
+ *.pyc
604
+
605
+ # Cake - Uncomment if you are using it
606
+ # tools/**
607
+ # !tools/packages.config
608
+
609
+ # Tabs Studio
610
+ *.tss
611
+
612
+ # Telerik's JustMock configuration file
613
+ *.jmconfig
614
+
615
+ # BizTalk build output
616
+ *.btp.cs
617
+ *.btm.cs
618
+ *.odx.cs
619
+ *.xsd.cs
620
+
621
+ # OpenCover UI analysis results
622
+ OpenCover/
623
+
624
+ # Azure Stream Analytics local run output
625
+ ASALocalRun/
626
+
627
+ # MSBuild Binary and Structured Log
628
+ *.binlog
629
+
630
+ # NVidia Nsight GPU debugger configuration file
631
+ *.nvuser
632
+
633
+ # MFractors (Xamarin productivity tool) working folder
634
+ .mfractor/
635
+
636
+ # Local History for Visual Studio
637
+ .localhistory/
638
+
639
+ # BeatPulse healthcheck temp database
640
+ healthchecksdb
641
+
642
+ # Backup folder for Package Reference Convert tool in Visual Studio 2017
643
+ MigrationBackup/
644
+
645
+ # Ionide (cross platform F# VS Code tools) working folder
646
+ .ionide/
647
+
648
+ # Fody - auto-generated XML schema
649
+ FodyWeavers.xsd
650
+
651
+ ### Python template
652
+ # Byte-compiled / optimized / DLL files
653
+ __pycache__/
654
+ *.py[cod]
655
+ *$py.class
656
+
657
+ # C extensions
658
+ *.so
659
+
660
+ # Distribution / packaging
661
+ .Python
662
+ build/
663
+ develop-eggs/
664
+ dist/
665
+ downloads/
666
+ eggs/
667
+ .eggs/
668
+ lib/
669
+ lib64/
670
+ parts/
671
+ sdist/
672
+ var/
673
+ wheels/
674
+ share/python-wheels/
675
+ *.egg-info/
676
+ .installed.cfg
677
+ *.egg
678
+ MANIFEST
679
+
680
+ # PyInstaller
681
+ # Usually these files are written by a python script from a template
682
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
683
+ *.manifest
684
+ *.spec
685
+
686
+ # Installer logs
687
+ pip-log.txt
688
+ pip-delete-this-directory.txt
689
+
690
+ # Unit test / coverage reports
691
+ htmlcov/
692
+ .tox/
693
+ .nox/
694
+ .coverage
695
+ .coverage.*
696
+ .cache
697
+ nosetests.xml
698
+ coverage.xml
699
+ *.cover
700
+ *.py,cover
701
+ .hypothesis/
702
+ .pytest_cache/
703
+ cover/
704
+
705
+ # Translations
706
+ *.mo
707
+ *.pot
708
+
709
+ # Django stuff:
710
+ *.log
711
+ local_settings.py
712
+ db.sqlite3
713
+ db.sqlite3-journal
714
+
715
+ # Flask stuff:
716
+ instance/
717
+ .webassets-cache
718
+
719
+ # Scrapy stuff:
720
+ .scrapy
721
+
722
+ # Sphinx documentation
723
+ docs/_build/
724
+
725
+ # PyBuilder
726
+ .pybuilder/
727
+ target/
728
+
729
+ # Jupyter Notebook
730
+ .ipynb_checkpoints
731
+
732
+ # IPython
733
+ profile_default/
734
+ ipython_config.py
735
+
736
+ # pyenv
737
+ # For a library or package, you might want to ignore these files since the code is
738
+ # intended to run in multiple environments; otherwise, check them in:
739
+ # .python-version
740
+
741
+ # pipenv
742
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
743
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
744
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
745
+ # install all needed dependencies.
746
+ #Pipfile.lock
747
+
748
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
749
+ __pypackages__/
750
+
751
+ # Celery stuff
752
+ celerybeat-schedule
753
+ celerybeat.pid
754
+
755
+ # SageMath parsed files
756
+ *.sage.py
757
+
758
+ # Environments
759
+ .env
760
+ .venv
761
+ env/
762
+ venv/
763
+ ENV/
764
+ env.bak/
765
+ venv.bak/
766
+
767
+ # Spyder project settings
768
+ .spyderproject
769
+ .spyproject
770
+
771
+ # Rope project settings
772
+ .ropeproject
773
+
774
+ # mkdocs documentation
775
+ /site
776
+
777
+ # mypy
778
+ .mypy_cache/
779
+ .dmypy.json
780
+ dmypy.json
781
+
782
+ # Pyre type checker
783
+ .pyre/
784
+
785
+ # pytype static type analyzer
786
+ .pytype/
787
+
788
+ # Cython debug symbols
789
+ cython_debug/
790
+
791
+ ### JupyterNotebooks template
792
+ # gitignore template for Jupyter Notebooks
793
+ # website: http://jupyter.org/
794
+
795
+ .ipynb_checkpoints
796
+ */.ipynb_checkpoints/*
797
+
798
+ # IPython
799
+ profile_default/
800
+ ipython_config.py
801
+
802
+ # Remove previous ipynb_checkpoints
803
+ # git rm -r .ipynb_checkpoints/
804
+
805
+ ### VirtualEnv template
806
+ # Virtualenv
807
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
808
+ .Python
809
+ [Bb]in
810
+ [Ii]nclude
811
+ [Ll]ib
812
+ [Ll]ib64
813
+ [Ll]ocal
814
+ [Ss]cripts
815
+ pyvenv.cfg
816
+ .venv
817
+ pip-selfcheck.json
818
+
819
+ ### Eclipse template
820
+ .metadata
821
+ bin/
822
+ tmp/
823
+ *.tmp
824
+ *.bak
825
+ *.swp
826
+ *~.nib
827
+ local.properties
828
+ .settings/
829
+ .loadpath
830
+ .recommenders
831
+
832
+ # External tool builders
833
+ .externalToolBuilders/
834
+
835
+ # Locally stored "Eclipse launch configurations"
836
+ *.launch
837
+
838
+ # PyDev specific (Python IDE for Eclipse)
839
+ *.pydevproject
840
+
841
+ # CDT-specific (C/C++ Development Tooling)
842
+ .cproject
843
+
844
+ # CDT- autotools
845
+ .autotools
846
+
847
+ # Java annotation processor (APT)
848
+ .factorypath
849
+
850
+ # PDT-specific (PHP Development Tools)
851
+ .buildpath
852
+
853
+ # sbteclipse plugin
854
+ .target
855
+
856
+ # Tern plugin
857
+ .tern-project
858
+
859
+ # TeXlipse plugin
860
+ .texlipse
861
+
862
+ # STS (Spring Tool Suite)
863
+ .springBeans
864
+
865
+ # Code Recommenders
866
+ .recommenders/
867
+
868
+ # Annotation Processing
869
+ .apt_generated/
870
+ .apt_generated_test/
871
+
872
+ # Scala IDE specific (Scala & Java development for Eclipse)
873
+ .cache-main
874
+ .scala_dependencies
875
+ .worksheet
876
+
877
+ # Uncomment this line if you wish to ignore the project description file.
878
+ # Typically, this file would be tracked if it contains build/dependency configurations:
879
+ #.project
880
+
881
+ # CUSTOM
882
  .idea
883
  .DS_Store
884
  .DS_store
885
+ *.tmp.py
886
+ *.tmp.json
887
+ tmp
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🍲
4
  colorFrom: blue
5
  colorTo: red
6
  sdk: streamlit
7
- app_file: server.py
8
  pinned: false
9
  ---
10
 
@@ -13,8 +13,5 @@ pinned: false
13
 
14
  ### Launch demo:
15
  ```
16
- streamlit run server.py
17
- ```
18
-
19
- ### Modify config
20
- Add any custom ingredient to display in `config.json` with key `first_100` to be displayed in multi-select. `next_100` are for custom ingredient adding section (to provide autocomplete assist as we type)
4
  colorFrom: blue
5
  colorTo: red
6
  sdk: streamlit
7
+ app_file: app.py
8
  pinned: false
9
  ---
10
 
13
 
14
  ### Launch demo:
15
  ```
16
+ streamlit run app.py
17
+ ```
 
 
 
app.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import torch
4
+ from transformers import pipeline, set_seed
5
+ from transformers import AutoTokenizer
6
+
7
+ from PIL import (
8
+ Image,
9
+ ImageFont,
10
+ ImageDraw
11
+ )
12
+
13
+ import re
14
+ from examples import EXAMPLES
15
+ import meta
16
+ from utils import (
17
+ remote_css,
18
+ local_css,
19
+ load_image,
20
+ pure_comma_separation
21
+ )
22
+
23
+
24
+ class TextGeneration:
25
+ def __init__(self):
26
+ self.debug = True
27
+ self.dummy_output = {
28
+ 'directions': [
29
+ 'peel the potato and slice thinly.',
30
+ 'place in a microwave safe dish.',
31
+ 'cover with plastic wrap and microwave on high for 5 minutes.',
32
+ 'remove from the microwave and sprinkle with cheese.',
33
+ 'return to the microwave for 1 minute or until cheese is melted.',
34
+ 'return to the microwave for 1 minute or until cheese is melted.',
35
+ 'return to the microwave for 1 minute or until cheese is melted.'
36
+ ],
37
+ 'ingredients': [
38
+ '1 potato',
39
+ '1 slice cheese',
40
+ '1 potato',
41
+ '1 slice cheese'
42
+ '1 potato',
43
+ '1 slice cheese',
44
+ '1 slice cheese',
45
+ '1 potato',
46
+ '1 slice cheese'
47
+ '1 potato',
48
+ '1 slice cheese',
49
+ ],
50
+ 'title': 'Cheese Potatoes'
51
+ }
52
+ self.tokenizer = None
53
+ self.generator = None
54
+ self.task = "text2text-generation"
55
+ self.model_name_or_path = "flax-community/t5-recipe-generation"
56
+ self.h1_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Bold.ttf", 100)
57
+ self.h2_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Bold.ttf", 50)
58
+ self.p_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Regular.ttf", 30)
59
+ set_seed(42)
60
+
61
+ def _skip_special_tokens_and_prettify(self, text):
62
+ recipe_maps = {"<sep>": "--", "<section>": "\n"}
63
+ recipe_map_pattern = "|".join(map(re.escape, recipe_maps.keys()))
64
+
65
+ text = re.sub(
66
+ recipe_map_pattern,
67
+ lambda m: recipe_maps[m.group()],
68
+ re.sub("|".join(self.tokenizer.all_special_tokens), "", text)
69
+ )
70
+
71
+ data = {"title": "", "ingredients": [], "directions": []}
72
+ for section in text.split("\n"):
73
+ section = section.strip()
74
+ if section.startswith("title:"):
75
+ data["title"] = " ".join(
76
+ [w.strip().capitalize() for w in section.replace("title:", "").strip().split() if w.strip()]
77
+ )
78
+ elif section.startswith("ingredients:"):
79
+ data["ingredients"] = [s.strip() for s in section.replace("ingredients:", "").split('--')]
80
+ elif section.startswith("directions:"):
81
+ data["directions"] = [s.strip() for s in section.replace("directions:", "").split('--')]
82
+ else:
83
+ pass
84
+
85
+ return data
86
+
87
+ def load(self):
88
+ if not self.debug:
89
+ self.tokenizer = AutoTokenizer.from_pretrained(self.model_name_or_path)
90
+ self.generator = pipeline(self.task, model=self.model_name_or_path, tokenizer=self.model_name_or_path)
91
+
92
+ def prepare_frame(self, recipe, frame):
93
+ im_editable = ImageDraw.Draw(frame)
94
+ # Title
95
+ ws, hs = 120, 500
96
+ im_editable.text(
97
+ (ws, hs),
98
+ recipe["title"],
99
+ (61, 61, 70),
100
+ font=self.h1_font,
101
+ )
102
+ # Ingredients
103
+ hs = hs + 200
104
+ im_editable.text(
105
+ (ws, hs),
106
+ "Ingredients",
107
+ (61, 61, 70),
108
+ font=self.h2_font,
109
+ )
110
+ hs = hs + 80
111
+ im_editable.text(
112
+ (ws + 10, hs),
113
+ "\n".join([f"- {item}" for item in recipe["ingredients"]]),
114
+ (61, 61, 70),
115
+ font=self.p_font,
116
+ )
117
+ # Directions
118
+ hs = hs + 400
119
+ im_editable.text(
120
+ (ws, hs),
121
+ "Directions",
122
+ (61, 61, 70),
123
+ font=self.h2_font,
124
+ )
125
+ hs = hs + 80
126
+ im_editable.text(
127
+ (ws + 10, hs),
128
+ "\n".join([f"- {item}" for item in recipe["directions"]]),
129
+ (61, 61, 70),
130
+ font=self.p_font,
131
+ )
132
+ return frame
133
+
134
+ def generate(self, items, generation_kwargs):
135
+ print(generation_kwargs)
136
+ if not self.debug:
137
+ generation_kwargs["num_return_sequences"] = 1
138
+ # generation_kwargs["return_full_text"] = False
139
+ generation_kwargs["return_tensors"] = True
140
+ generation_kwargs["return_text"] = False
141
+
142
+ generated_ids = self.generator(
143
+ items,
144
+ **generation_kwargs,
145
+ )[0]["generated_token_ids"]
146
+ recipe = self.tokenizer.decode(generated_ids, skip_special_tokens=False)
147
+ recipe = self._skip_special_tokens_and_prettify(recipe)
148
+ return recipe
149
+
150
+ return self.dummy_output
151
+
152
+ def generate_frame(self, recipe):
153
+ frame = load_image("asset/images/recipe-post.png")
154
+ return self.prepare_frame(recipe, frame)
155
+
156
+
157
+ @st.cache(allow_output_mutation=True)
158
+ def load_text_generator():
159
+ generator = TextGeneration()
160
+ generator.load()
161
+ return generator
162
+
163
+
164
+ chef_top = {
165
+ "max_length": 512,
166
+ "min_length": 64,
167
+ "no_repeat_ngram_size": 3,
168
+ "do_sample": True,
169
+ "top_k": 60,
170
+ "top_p": 0.95,
171
+ "num_return_sequences": 1
172
+ }
173
+ chef_beam = {
174
+ "max_length": 512,
175
+ "min_length": 64,
176
+ "no_repeat_ngram_size": 3,
177
+ "early_stopping": True,
178
+ "num_beams": 5,
179
+ "length_penalty": 1.5,
180
+ "num_return_sequences": 1
181
+ }
182
+
183
+
184
+ def main():
185
+ st.set_page_config(
186
+ page_title="Chef Transformer",
187
+ page_icon="🍲",
188
+ layout="wide",
189
+ initial_sidebar_state="expanded"
190
+ )
191
+ generator = load_text_generator()
192
+ local_css("asset/css/style.css")
193
+
194
+ st.sidebar.image(load_image("asset/images/chef-transformer-transparent.png"), width=310)
195
+ st.sidebar.title("Choose your own chef")
196
+ chef = st.sidebar.selectbox("Chef", index=0, options=["Chef Scheherazade", "Chef Giovanni"])
197
+
198
+ st.markdown(meta.HEADER_INFO)
199
+ prompts = list(EXAMPLES.keys()) + ["Custom"]
200
+ prompt = st.selectbox('Examples', prompts, index=len(prompts) - 1)
201
+
202
+ if prompt == "Custom":
203
+ prompt_box = ""
204
+ else:
205
+ prompt_box = EXAMPLES[prompt]
206
+
207
+ items = st.text_input(
208
+ 'Add custom ingredients here (separated by `,`): ',
209
+ pure_comma_separation(prompt_box, return_list=False),
210
+ key="custom_keywords",
211
+ max_chars=1000)
212
+ items = pure_comma_separation(items, return_list=False)
213
+ entered_items = st.empty()
214
+
215
+ if st.button('Get Recipe!'):
216
+ entered_items.markdown("**Generate recipe for:** " + items)
217
+ with st.spinner("Generating recipe..."):
218
+
219
+ gen_kw = chef_top if chef == "Chef Scheherazade" else chef_beam
220
+ generated_recipe = generator.generate(items, gen_kw)
221
+ recipe_post = generator.generate_frame(generated_recipe)
222
+
223
+ col1, col2, col3 = st.beta_columns([1, 6, 1])
224
+ with col1:
225
+ st.write("")
226
+
227
+ with col2:
228
+ st.image(
229
+ recipe_post,
230
+ # width=500,
231
+ caption="Your recipe",
232
+ use_column_width="auto",
233
+ output_format="PNG"
234
+ )
235
+
236
+ with col3:
237
+ st.write("")
238
+
239
+
240
+ if __name__ == '__main__':
241
+ main()
asset/css/style.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ body {
2
+ background-color: #eee;
3
+ }
4
+
5
+ .fullScreenFrame > div {
6
+ display: flex;
7
+ justify-content: center;
8
+ }
asset/fonts/PT_Serif/OFL.txt ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public),
2
+ with Reserved Font Names "PT Sans", "PT Serif" and "ParaType".
3
+
4
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
+ This license is copied below, and is also available with a FAQ at:
6
+ http://scripts.sil.org/OFL
7
+
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font creation
16
+ efforts of academic and linguistic communities, and to provide a free and
17
+ open framework in which fonts may be shared and improved in partnership
18
+ with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply
27
+ to any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software components as
38
+ distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to, deleting,
41
+ or substituting -- in part or in whole -- any of the components of the
42
+ Original Version, by changing formats or by porting the Font Software to a
43
+ new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical
46
+ writer or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
51
+ redistribute, and sell modified and unmodified copies of the Font
52
+ Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components,
55
+ in Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the corresponding
66
+ Copyright Holder. This restriction only applies to the primary font name as
67
+ presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created
79
+ using the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
asset/fonts/PT_Serif/PTSerif-Bold.ttf ADDED
Binary file (196 kB). View file
asset/fonts/PT_Serif/PTSerif-BoldItalic.ttf ADDED
Binary file (193 kB). View file
asset/fonts/PT_Serif/PTSerif-Italic.ttf ADDED
Binary file (232 kB). View file
asset/fonts/PT_Serif/PTSerif-Regular.ttf ADDED
Binary file (215 kB). View file
{images → asset/images}/chef-transformer-transparent.png RENAMED
File without changes
{images → asset/images}/chef-transformer.png RENAMED
File without changes
{images → asset/images}/logo.png RENAMED
File without changes
asset/images/recipe-frame.png ADDED
asset/images/recipe-post.png ADDED
beam_search.py DELETED
@@ -1,63 +0,0 @@
1
- import torch
2
- from transformers import AutoModelForSeq2SeqLM
3
- from transformers import AutoTokenizer
4
- from transformers import pipeline
5
-
6
- from pprint import pprint
7
- import re
8
-
9
-
10
- # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
11
- # MODEL_NAME_OR_PATH = "flax-community/t5-recipe-generation"
12
- # tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH, use_fast=True)
13
- # model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME_OR_PATH)
14
-
15
-
16
- def skip_special_tokens_and_prettify(text, tokenizer):
17
- recipe_maps = {"<sep>": "--", "<section>": "\n"}
18
- recipe_map_pattern = "|".join(map(re.escape, recipe_maps.keys()))
19
-
20
- text = re.sub(
21
- recipe_map_pattern,
22
- lambda m: recipe_maps[m.group()],
23
- re.sub("|".join(tokenizer.all_special_tokens), "", text)
24
- )
25
-
26
- data = {"title": "", "ingredients": [], "directions": []}
27
- for section in text.split("\n"):
28
- section = section.strip()
29
- section = section.strip()
30
- if section.startswith("title:"):
31
- data["title"] = section.replace("title:", "").strip()
32
- elif section.startswith("ingredients:"):
33
- data["ingredients"] = [s.strip() for s in section.replace("ingredients:", "").split('--')]
34
- elif section.startswith("directions:"):
35
- data["directions"] = [s.strip() for s in section.replace("directions:", "").split('--')]
36
- else:
37
- pass
38
-
39
- return data
40
-
41
-
42
- def post_generator(output_tensors, tokenizer):
43
- output_tensors = [output_tensors[i]["generated_token_ids"] for i in range(len(output_tensors))]
44
- texts = tokenizer.batch_decode(output_tensors, skip_special_tokens=False)
45
- texts = [skip_special_tokens_and_prettify(text, tokenizer) for text in texts]
46
- return texts
47
-
48
-
49
- # Example
50
- generate_kwargs = {
51
- "max_length": 512,
52
- "min_length": 64,
53
- "no_repeat_ngram_size": 3,
54
- "early_stopping": True,
55
- "num_beams": 5,
56
- "length_penalty": 1.5,
57
- "num_return_sequences": 2
58
- }
59
- items = "potato, cheese"
60
- # generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
61
- # generated = generator(items, return_tensors=True, return_text=False, **generate_kwargs)
62
- # outputs = post_generator(generated, tokenizer)
63
- # pprint(outputs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config.json DELETED
@@ -1,207 +0,0 @@
1
- {
2
- "model_name_or_path": "flax-community/t5-recipe-generation",
3
- "first_100": [
4
- "allspice",
5
- "almond extract",
6
- "applesauce",
7
- "avocado",
8
- "balsamic vinegar",
9
- "basil",
10
- "bay leaf",
11
- "beets",
12
- "bread crumbs",
13
- "bread flour",
14
- "buns",
15
- "catsup",
16
- "cayenne",
17
- "cherry tomatoes",
18
- "chicken breasts",
19
- "chives",
20
- "chocolate cake",
21
- "coconut milk",
22
- "cold butter",
23
- "cold milk",
24
- "cooking oil",
25
- "cornstarch",
26
- "crab meat",
27
- "crackers",
28
- "cream of chicken soup",
29
- "cream of tartar",
30
- "cumin",
31
- "cumin seeds",
32
- "curry powder",
33
- "egg yolk",
34
- "extra-virgin olive oil",
35
- "feta cheese",
36
- "flaked coconut",
37
- "flat leaf parsley",
38
- "flour tortillas",
39
- "fresh chives",
40
- "fresh cilantro",
41
- "fresh mint",
42
- "fresh oregano",
43
- "fresh rosemary",
44
- "frozen strawberries",
45
- "gingerroot",
46
- "green olives",
47
- "ground allspice",
48
- "ground chuck",
49
- "ground coriander",
50
- "ground cumin",
51
- "ground pork",
52
- "ground red pepper",
53
- "hamburger",
54
- "hazelnuts",
55
- "heavy cream",
56
- "heavy whipping cream",
57
- "hot pepper",
58
- "italian dressing",
59
- "lean ground beef",
60
- "lemon juice",
61
- "lemon pepper",
62
- "marjoram",
63
- "miracle",
64
- "noodles",
65
- "nuts",
66
- "oatmeal",
67
- "oats",
68
- "oleo",
69
- "olive oil",
70
- "onion salt",
71
- "onions",
72
- "orange",
73
- "paprika",
74
- "parmesan cheese",
75
- "parsley",
76
- "pasta",
77
- "peaches",
78
- "pecans",
79
- "pork sausage",
80
- "pork tenderloin",
81
- "poultry seasoning",
82
- "powdered sugar",
83
- "pumpkin",
84
- "red potatoes",
85
- "red wine vinegar",
86
- "rosemary",
87
- "salmon",
88
- "scallion",
89
- "sesame oil",
90
- "shell",
91
- "stalks celery",
92
- "tabasco sauce",
93
- "tarragon",
94
- "tomatoes",
95
- "unsalted butter",
96
- "vanilla wafers",
97
- "vegetables",
98
- "warm water",
99
- "whipping cream",
100
- "white wine vinegar",
101
- "whole wheat flour",
102
- "yellow squash",
103
- "yogurt"
104
- ],
105
- "next_100": [
106
- "active dry yeast",
107
- "almonds",
108
- "apple",
109
- "apple cider",
110
- "apple cider vinegar",
111
- "avocados",
112
- "baby spinach",
113
- "bay leaves",
114
- "bean sprouts",
115
- "beef",
116
- "beef broth",
117
- "broccoli",
118
- "cabbage",
119
- "capers",
120
- "cashews",
121
- "celery",
122
- "celery salt",
123
- "cherries",
124
- "cherry pie filling",
125
- "chicken",
126
- "chicken broth",
127
- "chicken stock",
128
- "chickpeas",
129
- "chili sauce",
130
- "chocolate",
131
- "cinnamon",
132
- "cloves",
133
- "corn",
134
- "cottage cheese",
135
- "cranberry sauce",
136
- "egg noodles",
137
- "egg yolks",
138
- "extra virgin olive oil",
139
- "freshly ground pepper",
140
- "garlic powder",
141
- "golden raisins",
142
- "graham cracker crust",
143
- "graham crackers",
144
- "green peppers",
145
- "ground black pepper",
146
- "ground nutmeg",
147
- "ground pepper",
148
- "ground turmeric",
149
- "kosher salt",
150
- "lemon rind",
151
- "mango",
152
- "mint",
153
- "mustard",
154
- "nutmeg",
155
- "orange juice",
156
- "orange zest",
157
- "oregano",
158
- "peanut butter",
159
- "peas",
160
- "pecan halves",
161
- "pepperoni",
162
- "pine nuts",
163
- "pinto beans",
164
- "pizza sauce",
165
- "plain yogurt",
166
- "potatoes",
167
- "raisins",
168
- "red",
169
- "red bell peppers",
170
- "red pepper",
171
- "red peppers",
172
- "rhubarb",
173
- "ricotta cheese",
174
- "salad oil",
175
- "sauce",
176
- "scallions",
177
- "sesame seeds",
178
- "sherry",
179
- "shredded cheese",
180
- "skinless",
181
- "soda",
182
- "soy sauce",
183
- "spinach",
184
- "strawberries",
185
- "sugar",
186
- "sweet onion",
187
- "sweet potatoes",
188
- "swiss cheese",
189
- "t",
190
- "tomato",
191
- "tomato paste",
192
- "tomato soup",
193
- "tuna",
194
- "vanilla bean",
195
- "vanilla ice cream",
196
- "vanilla pudding",
197
- "vegetable broth",
198
- "vegetable oil",
199
- "vegetable shortening",
200
- "whipped cream",
201
- "white onion",
202
- "white sugar",
203
- "yellow cake",
204
- "yellow cornmeal",
205
- "zucchini"
206
- ]
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
examples.py ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ EXAMPLES = {
2
+ "Recipe Name 1": "cheese, potato",
3
+ }
meta.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ HEADER_INFO = """
2
+ # Chef Transformer 🍲
3
+
4
+ This demo uses [T5 trained on RecipeNLG](https://huggingface.co/flax-community/t5-recipe-generation) "
5
+ to generate recipe from a given set of ingredients
6
+ """.strip()
7
+ SIDEBAR_INFO = """
8
+ # Configuration
9
+ """.strip()
10
+ PROMPT_BOX = "Add custom ingredients here (separated by `,`): "
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
- streamlit==0.84.1
2
- transformers==4.8.2
3
- torch==1.9.0
4
- streamlit-tags==1.2.7
1
+ streamlit
2
+ transformers
3
+ torch
 
server.py DELETED
@@ -1,109 +0,0 @@
1
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
2
- from datetime import datetime as dt
3
- import streamlit as st
4
- from streamlit_tags import st_tags
5
- import beam_search
6
- import top_sampling
7
- from pprint import pprint
8
- import json
9
-
10
- with open("config.json") as f:
11
- cfg = json.loads(f.read())
12
-
13
- st.set_page_config(layout="wide")
14
-
15
-
16
- @st.cache(allow_output_mutation=True)
17
- def load_model():
18
- tokenizer = AutoTokenizer.from_pretrained(cfg["model_name_or_path"])
19
- model = AutoModelForSeq2SeqLM.from_pretrained(cfg["model_name_or_path"])
20
- generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
21
- return generator, tokenizer
22
-
23
-
24
- def sampling_changed(obj):
25
- print(obj)
26
-
27
-
28
- with st.spinner('Loading model...'):
29
- generator, tokenizer = load_model()
30
- # st.image("images/chef-transformer.png", width=400)
31
- st.header("Chef Transformer 👩‍🍳 / 👨‍🍳")
32
- st.markdown(
33
- "This demo uses [T5 trained on RecipeNLG](https://huggingface.co/flax-community/t5-recipe-generation) "
34
- "to generate recipe from a given set of ingredients"
35
- )
36
- img = st.sidebar.image("images/chef-transformer-transparent.png", width=310)
37
- add_text_sidebar = st.sidebar.title("Popular Recipes")
38
- add_text_sidebar = st.sidebar.text("Recipe preset(example#1)")
39
- add_text_sidebar = st.sidebar.text("Recipe preset(example#2)")
40
-
41
- add_text_sidebar = st.sidebar.title("Mode")
42
- sampling_mode = st.sidebar.selectbox("Select a Mode", index=0, options=["Top Sampling", "Beam Search"])
43
-
44
- original_keywords = st.multiselect(
45
- "Choose ingredients",
46
- cfg["first_100"],
47
- ["parmesan cheese", "fresh oregano", "basil", "whole wheat flour"]
48
- )
49
-
50
- st.write("Add custom ingredients here:")
51
- custom_keywords = st_tags(
52
- label="",
53
- text='Press enter to add more',
54
- value=['salt'],
55
- suggestions=["z"],
56
- maxtags=15,
57
- key='tags')
58
-
59
- # def custom_keywords_on_change():
60
- # pass
61
-
62
-
63
- # custom_keywords = st.text_input(
64
- # 'Add custom ingredients here (separated by `,`): ',
65
- # ", ".join(["salt", "pepper"]),
66
- # key="custom_keywords",
67
- # # on_change=custom_keywords_on_change,
68
- # max_chars=1000)
69
- # custom_keywords = list(set([x.strip() for x in custom_keywords.strip().split(',') if len(x.strip()) > 0]))
70
-
71
- all_ingredients = []
72
- all_ingredients.extend(original_keywords)
73
- all_ingredients.extend(custom_keywords)
74
- all_ingredients = ", ".join(all_ingredients)
75
- st.markdown("**Generate recipe for:** " + all_ingredients)
76
-
77
- submit = st.button('Get Recipe!')
78
- if submit:
79
- with st.spinner('Generating recipe...'):
80
- if sampling_mode == "Beam Search":
81
- generated = generator(
82
- all_ingredients,
83
- return_tensors=True,
84
- return_text=False,
85
- **beam_search.generate_kwargs)
86
- outputs = beam_search.post_generator(generated, tokenizer)
87
- elif sampling_mode == "Top Sampling":
88
- generated = generator(
89
- all_ingredients,
90
- return_tensors=True,
91
- return_text=False,
92
- **top_sampling.generate_kwargs)
93
- outputs = top_sampling.post_generator(generated, tokenizer)
94
- output = outputs[0]
95
- output['title'] = " ".join([w.capitalize() for w in output['title'].split()])
96
- markdown_output = ""
97
- markdown_output += f"## {output['title']}\
98
- "
99
- markdown_output += f"#### Ingredients:\
100
- "
101
- for o in output["ingredients"]:
102
- markdown_output += f"- {o}\
103
- "
104
- markdown_output += f"#### Directions:\
105
- "
106
- for o in output["directions"]:
107
- markdown_output += f"- {o}\
108
- "
109
- st.markdown(markdown_output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
top_sampling.py DELETED
@@ -1,63 +0,0 @@
1
- import torch
2
- from transformers import AutoModelForSeq2SeqLM
3
- from transformers import AutoTokenizer
4
- from transformers import pipeline
5
-
6
- from pprint import pprint
7
- import re
8
-
9
-
10
- # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
11
- # MODEL_NAME_OR_PATH = "flax-community/t5-recipe-generation"
12
- # tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH, use_fast=True)
13
- # model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME_OR_PATH)
14
-
15
-
16
- def skip_special_tokens_and_prettify(text, tokenizer):
17
- recipe_maps = {"<sep>": "--", "<section>": "\n"}
18
- recipe_map_pattern = "|".join(map(re.escape, recipe_maps.keys()))
19
-
20
- text = re.sub(
21
- recipe_map_pattern,
22
- lambda m: recipe_maps[m.group()],
23
- re.sub("|".join(tokenizer.all_special_tokens), "", text)
24
- )
25
-
26
- data = {"title": "", "ingredients": [], "directions": []}
27
- for section in text.split("\n"):
28
- section = section.strip()
29
- section = section.strip()
30
- if section.startswith("title:"):
31
- data["title"] = section.replace("title:", "").strip()
32
- elif section.startswith("ingredients:"):
33
- data["ingredients"] = [s.strip() for s in section.replace("ingredients:", "").split('--')]
34
- elif section.startswith("directions:"):
35
- data["directions"] = [s.strip() for s in section.replace("directions:", "").split('--')]
36
- else:
37
- pass
38
-
39
- return data
40
-
41
-
42
- def post_generator(output_tensors, tokenizer):
43
- output_tensors = [output_tensors[i]["generated_token_ids"] for i in range(len(output_tensors))]
44
- texts = tokenizer.batch_decode(output_tensors, skip_special_tokens=False)
45
- texts = [skip_special_tokens_and_prettify(text, tokenizer) for text in texts]
46
- return texts
47
-
48
-
49
- # Example
50
- generate_kwargs = {
51
- "max_length": 512,
52
- "min_length": 64,
53
- "no_repeat_ngram_size": 3,
54
- "do_sample": True,
55
- "top_k": 60,
56
- "top_p": 0.95,
57
- "num_return_sequences": 3
58
- }
59
- # items = "potato, cheese"
60
- # generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
61
- # generated = generator(items, return_tensors=True, return_text=False, **generate_kwargs)
62
- # outputs = post_generator(generated, tokenizer)
63
- # pprint(outputs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
utils.py CHANGED
@@ -33,3 +33,10 @@ def local_css(css_path):
33
 
34
  def remote_css(css_url):
35
  st.markdown(f'<link href="{css_url}" rel="stylesheet">', unsafe_allow_html=True)
 
 
 
 
 
 
 
33
 
34
  def remote_css(css_url):
35
  st.markdown(f'<link href="{css_url}" rel="stylesheet">', unsafe_allow_html=True)
36
+
37
+
38
+ def pure_comma_separation(list_str, return_list=True):
39
+ r = list(set([x.strip() for x in list_str.strip().split(',') if len(x.strip()) > 0]))
40
+ if return_list:
41
+ return r
42
+ return ", ".join(r)