Spaces:
Running
Running
uberdock model; live interface
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ from torchmoji.model_def import torchmoji_emojis
|
|
| 13 |
|
| 14 |
from huggingface_hub import hf_hub_download
|
| 15 |
|
| 16 |
-
model_name = "
|
| 17 |
model_path = hf_hub_download(repo_id=model_name, filename="pytorch_model.bin")
|
| 18 |
vocab_path = hf_hub_download(repo_id=model_name, filename="vocabulary.json")
|
| 19 |
|
|
@@ -54,11 +54,18 @@ def predict(deepmoji_analysis, emoji_count):
|
|
| 54 |
|
| 55 |
return str(tokenized) + output_text
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
gradio_app = gr.Interface(
|
| 58 |
predict,
|
| 59 |
[
|
| 60 |
-
|
| 61 |
-
|
| 62 |
],
|
| 63 |
outputs="text",
|
| 64 |
examples=[
|
|
@@ -69,7 +76,8 @@ gradio_app = gr.Interface(
|
|
| 69 |
["What is happening to me??", 5],
|
| 70 |
["This is the shit!", 5],
|
| 71 |
["This is shit!", 5],
|
| 72 |
-
]
|
|
|
|
| 73 |
)
|
| 74 |
|
| 75 |
if __name__ == "__main__":
|
|
|
|
| 13 |
|
| 14 |
from huggingface_hub import hf_hub_download
|
| 15 |
|
| 16 |
+
model_name = "Uberduck/torchmoji"
|
| 17 |
model_path = hf_hub_download(repo_id=model_name, filename="pytorch_model.bin")
|
| 18 |
vocab_path = hf_hub_download(repo_id=model_name, filename="vocabulary.json")
|
| 19 |
|
|
|
|
| 54 |
|
| 55 |
return str(tokenized) + output_text
|
| 56 |
|
| 57 |
+
input_textbox = gr.Textbox(
|
| 58 |
+
label="English Text",
|
| 59 |
+
lines=1,
|
| 60 |
+
value=""
|
| 61 |
+
)
|
| 62 |
+
slider = gr.Slider(1, 64, value=5, step=1, label="Top # Emoji", info="Choose between 1 and 64")
|
| 63 |
+
|
| 64 |
gradio_app = gr.Interface(
|
| 65 |
predict,
|
| 66 |
[
|
| 67 |
+
input_textbox,
|
| 68 |
+
slider,
|
| 69 |
],
|
| 70 |
outputs="text",
|
| 71 |
examples=[
|
|
|
|
| 76 |
["What is happening to me??", 5],
|
| 77 |
["This is the shit!", 5],
|
| 78 |
["This is shit!", 5],
|
| 79 |
+
],
|
| 80 |
+
live=True
|
| 81 |
)
|
| 82 |
|
| 83 |
if __name__ == "__main__":
|