Spaces:
Paused
Paused
Upload 4 files
Browse files
README.md
CHANGED
|
@@ -9,6 +9,7 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
header: mini
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
header: mini
|
| 12 |
+
hf_oauth: true
|
| 13 |
---
|
| 14 |
|
| 15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -70,7 +70,9 @@ def main():
|
|
| 70 |
with gr.Group():
|
| 71 |
output_text_pony = gr.TextArea(label="Output tags (Pony e621 style)", interactive=False, show_copy_button=True)
|
| 72 |
copy_btn_pony = gr.Button(value="Copy to clipboard", size="sm", interactive=False)
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
|
| 75 |
random_character.click(select_random_character, [input_copyright, input_character], [input_copyright, input_character], queue=False)
|
| 76 |
|
|
|
|
| 70 |
with gr.Group():
|
| 71 |
output_text_pony = gr.TextArea(label="Output tags (Pony e621 style)", interactive=False, show_copy_button=True)
|
| 72 |
copy_btn_pony = gr.Button(value="Copy to clipboard", size="sm", interactive=False)
|
| 73 |
+
description_ui2()
|
| 74 |
+
gr.LoginButton()
|
| 75 |
+
gr.DuplicateButton(value="Duplicate Space for private use")
|
| 76 |
|
| 77 |
random_character.click(select_random_character, [input_copyright, input_character], [input_copyright, input_character], queue=False)
|
| 78 |
|
requirements.txt
CHANGED
|
@@ -5,8 +5,6 @@ transformers
|
|
| 5 |
optimum[onnxruntime]
|
| 6 |
spaces
|
| 7 |
dartrs
|
| 8 |
-
|
| 9 |
-
httpcore
|
| 10 |
-
googletrans==4.0.0rc1
|
| 11 |
sentencepiece
|
| 12 |
timm
|
|
|
|
| 5 |
optimum[onnxruntime]
|
| 6 |
spaces
|
| 7 |
dartrs
|
| 8 |
+
translatepy
|
|
|
|
|
|
|
| 9 |
sentencepiece
|
| 10 |
timm
|
tagger.py
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
| 4 |
-
import
|
| 5 |
-
from transformers import (
|
| 6 |
-
AutoImageProcessor,
|
| 7 |
-
AutoModelForImageClassification,
|
| 8 |
-
)
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
|
|
@@ -190,18 +187,16 @@ def convert_danbooru_to_e621_prompt(input_prompt: str = "", prompt_type: str = "
|
|
| 190 |
return output_prompt
|
| 191 |
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
from googletrans import Translator
|
| 198 |
-
translator = Translator()
|
| 199 |
try:
|
| 200 |
-
|
| 201 |
-
return translated_prompt
|
| 202 |
except Exception as e:
|
|
|
|
| 203 |
print(e)
|
| 204 |
-
|
| 205 |
|
| 206 |
def is_japanese(s):
|
| 207 |
import unicodedata
|
|
@@ -223,18 +218,23 @@ def translate_prompt(prompt: str = ""):
|
|
| 223 |
return ", ".join(outputs)
|
| 224 |
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
def translate_prompt_to_ja(prompt: str = ""):
|
| 227 |
-
def translate_to_japanese(
|
| 228 |
-
import httpcore
|
| 229 |
-
setattr(httpcore, 'SyncHTTPTransport', 'AsyncHTTPProxy')
|
| 230 |
-
from googletrans import Translator
|
| 231 |
-
translator = Translator()
|
| 232 |
try:
|
| 233 |
-
|
| 234 |
-
return translated_prompt
|
| 235 |
except Exception as e:
|
|
|
|
| 236 |
print(e)
|
| 237 |
-
|
| 238 |
|
| 239 |
def is_japanese(s):
|
| 240 |
import unicodedata
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
from PIL import Image
|
| 3 |
import torch
|
| 4 |
import gradio as gr
|
| 5 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
|
|
|
|
| 187 |
return output_prompt
|
| 188 |
|
| 189 |
|
| 190 |
+
from translatepy import Translator
|
| 191 |
+
translator = Translator()
|
| 192 |
+
def translate_prompt_old(prompt: str = ""):
|
| 193 |
+
def translate_to_english(input: str):
|
|
|
|
|
|
|
| 194 |
try:
|
| 195 |
+
output = str(translator.translate(input, 'English'))
|
|
|
|
| 196 |
except Exception as e:
|
| 197 |
+
output = input
|
| 198 |
print(e)
|
| 199 |
+
return output
|
| 200 |
|
| 201 |
def is_japanese(s):
|
| 202 |
import unicodedata
|
|
|
|
| 218 |
return ", ".join(outputs)
|
| 219 |
|
| 220 |
|
| 221 |
+
def translate_prompt(input: str):
|
| 222 |
+
try:
|
| 223 |
+
output = str(translator.translate(input, 'English'))
|
| 224 |
+
except Exception as e:
|
| 225 |
+
output = input
|
| 226 |
+
print(e)
|
| 227 |
+
return output
|
| 228 |
+
|
| 229 |
+
|
| 230 |
def translate_prompt_to_ja(prompt: str = ""):
|
| 231 |
+
def translate_to_japanese(input: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
try:
|
| 233 |
+
output = str(translator.translate(input, 'Japanese'))
|
|
|
|
| 234 |
except Exception as e:
|
| 235 |
+
output = input
|
| 236 |
print(e)
|
| 237 |
+
return output
|
| 238 |
|
| 239 |
def is_japanese(s):
|
| 240 |
import unicodedata
|