John6666 ooferdoodles commited on
Commit
9b9d2b8
0 Parent(s):

Super-squash branch 'main' using huggingface_hub

Browse files

Co-authored-by: ooferdoodles <[email protected]>

Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +35 -0
  4. requirements.txt +1 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Text2tags Demo
3
+ emoji: 👀
4
+ colorFrom: red
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 4.36.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: openrail
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from text2tags import TaggerLlama
3
+
4
+ model = TaggerLlama()
5
+
6
+ def predict(caption, max_tokens=128, temperature=0.8, top_k=40, top_p=0.95, repeat_penalty=1.1):
7
+ tags = model.predict_tags(caption, max_tokens=max_tokens, temperature=temperature,
8
+ top_k=top_k, top_p=top_p, repeat_penalty=repeat_penalty)
9
+ return ', '.join(tags)
10
+
11
+ description = """
12
+ ### Enter a caption to extract danbooru tags from it.
13
+ This space is duplicated from [ooferdoodles/text2tags-demo](https://huggingface.co/spaces/ooferdoodles/text2tags-demo)
14
+ """
15
+
16
+ demo = gr.Interface(
17
+ fn=predict,
18
+ inputs=[
19
+ gr.Textbox(label="Caption"),
20
+ gr.Slider(0, 256, step=16, value=128, label='max_tokens'),
21
+ gr.Slider(0, 2, step=0.1, value=0.8, label='temperature'),
22
+ gr.Slider(0, 100, step=5, value=40, label='top_k'),
23
+ gr.Slider(0, 2, step=0.05, value=0.95, label='top_p'),
24
+ gr.Slider(0, 5, step=0.1, value=1.1, label='repeat_penalty'),
25
+ ],
26
+ outputs="text",
27
+ title="Text2Tags",
28
+ description=description,
29
+ examples=[
30
+ ["Minato Aqua from hololive with pink and blue twintails in a blue maid outfit"],
31
+ ],
32
+ allow_flagging="never"
33
+ )
34
+
35
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ text2tags-lib