Spaces:
Running
Running
Vsevolod Ignatyev commited on
Deploy TinyModel1Space from GitHub Actions
Browse files
app.py
CHANGED
|
@@ -3,7 +3,9 @@ import gradio as gr
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
MODEL_ID = "HyperlinksSpace/TinyModel1"
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
_clf = None
|
| 8 |
|
| 9 |
|
|
@@ -63,7 +65,21 @@ EXAMPLES = [
|
|
| 63 |
with gr.Blocks(title="TinyModel1Space") as demo:
|
| 64 |
gr.Markdown("# TinyModel1Space")
|
| 65 |
gr.Markdown("Model: `HyperlinksSpace/TinyModel1`")
|
| 66 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
inp = gr.Textbox(lines=4, label="Input text", placeholder="Paste a news sentence here...")
|
| 68 |
out = gr.Label(num_top_classes=4, label="Predicted class probabilities")
|
| 69 |
status = gr.Textbox(label="Status", interactive=False)
|
|
@@ -74,6 +90,6 @@ with gr.Blocks(title="TinyModel1Space") as demo:
|
|
| 74 |
gr.Examples(examples=EXAMPLES, inputs=inp, cache_examples=False)
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
| 77 |
-
print(f"
|
| 78 |
demo.queue(default_concurrency_limit=4)
|
| 79 |
demo.launch(ssr_mode=False)
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
MODEL_ID = "HyperlinksSpace/TinyModel1"
|
| 6 |
+
PUBLIC_APP_URL = "https://hyperlinksspace-tinymodel1space.hf.space"
|
| 7 |
+
MODEL_HUB_URL = "https://huggingface.co/HyperlinksSpace/TinyModel1"
|
| 8 |
+
GITHUB_REPO_URL = "https://github.com/HyperlinksSpace/TinyModel"
|
| 9 |
_clf = None
|
| 10 |
|
| 11 |
|
|
|
|
| 65 |
with gr.Blocks(title="TinyModel1Space") as demo:
|
| 66 |
gr.Markdown("# TinyModel1Space")
|
| 67 |
gr.Markdown("Model: `HyperlinksSpace/TinyModel1`")
|
| 68 |
+
gr.Markdown(
|
| 69 |
+
"**Public URL (direct app):** ["
|
| 70 |
+
+ PUBLIC_APP_URL
|
| 71 |
+
+ "]("
|
| 72 |
+
+ PUBLIC_APP_URL
|
| 73 |
+
+ ")\n\n- **Model on Hugging Face:** ["
|
| 74 |
+
+ MODEL_HUB_URL
|
| 75 |
+
+ "]("
|
| 76 |
+
+ MODEL_HUB_URL
|
| 77 |
+
+ ")\n- **Source code (GitHub):** ["
|
| 78 |
+
+ GITHUB_REPO_URL
|
| 79 |
+
+ "]("
|
| 80 |
+
+ GITHUB_REPO_URL
|
| 81 |
+
+ ")"
|
| 82 |
+
)
|
| 83 |
inp = gr.Textbox(lines=4, label="Input text", placeholder="Paste a news sentence here...")
|
| 84 |
out = gr.Label(num_top_classes=4, label="Predicted class probabilities")
|
| 85 |
status = gr.Textbox(label="Status", interactive=False)
|
|
|
|
| 90 |
gr.Examples(examples=EXAMPLES, inputs=inp, cache_examples=False)
|
| 91 |
|
| 92 |
if __name__ == "__main__":
|
| 93 |
+
print(f"Public URL (direct): {PUBLIC_APP_URL}")
|
| 94 |
demo.queue(default_concurrency_limit=4)
|
| 95 |
demo.launch(ssr_mode=False)
|