Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -17,13 +17,7 @@ def _ensure_onnx(tier: str):
|
|
| 17 |
if not os.path.exists(path):
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
for t in ["tiny", "small", "base", "pro"]:
|
| 20 |
-
print(f"Downloading picotype_{t}.onnx...")
|
| 21 |
hf_hub_download("eulogik/pico-type-v02", filename=f"picotype_{t}.onnx", local_dir=MODEL_DIR)
|
| 22 |
-
try:
|
| 23 |
-
print(f"Downloading picotype_{t}.onnx.data...")
|
| 24 |
-
hf_hub_download("eulogik/pico-type-v02", filename=f"picotype_{t}.onnx.data", local_dir=MODEL_DIR)
|
| 25 |
-
except Exception as e:
|
| 26 |
-
print(f"No external data file found for tier {t} (might be self-contained): {e}")
|
| 27 |
return path
|
| 28 |
|
| 29 |
|
|
@@ -98,20 +92,12 @@ def build_ui():
|
|
| 98 |
|
| 99 |
gr.Examples(
|
| 100 |
examples=[
|
| 101 |
-
["def hello():
|
| 102 |
-
print('Hello, world!')"],
|
| 103 |
["The quick brown fox jumps over the lazy dog."],
|
| 104 |
["<html><body><h1>Welcome</h1></body></html>"],
|
| 105 |
-
["#!/usr/bin/env python3
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
["{
|
| 109 |
-
"name": "pico-type",
|
| 110 |
-
"version": "0.1.0"
|
| 111 |
-
}"],
|
| 112 |
-
["BEGIN:VCALENDAR
|
| 113 |
-
VERSION:2.0
|
| 114 |
-
END:VCALENDAR"],
|
| 115 |
],
|
| 116 |
inputs=[text_input],
|
| 117 |
label="Try these examples",
|
|
|
|
| 17 |
if not os.path.exists(path):
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
for t in ["tiny", "small", "base", "pro"]:
|
|
|
|
| 20 |
hf_hub_download("eulogik/pico-type-v02", filename=f"picotype_{t}.onnx", local_dir=MODEL_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
return path
|
| 22 |
|
| 23 |
|
|
|
|
| 92 |
|
| 93 |
gr.Examples(
|
| 94 |
examples=[
|
| 95 |
+
["def hello():\n print('Hello, world!')"],
|
|
|
|
| 96 |
["The quick brown fox jumps over the lazy dog."],
|
| 97 |
["<html><body><h1>Welcome</h1></body></html>"],
|
| 98 |
+
["#!/usr/bin/env python3\nimport os\nprint('hello')"],
|
| 99 |
+
["{\n \"name\": \"pico-type\",\n \"version\": \"0.1.0\"\n}"],
|
| 100 |
+
["BEGIN:VCALENDAR\nVERSION:2.0\nEND:VCALENDAR"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
],
|
| 102 |
inputs=[text_input],
|
| 103 |
label="Try these examples",
|