Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import transformers_gradio
|
| 3 |
+
|
| 4 |
+
# CPU環境のため spaces.GPU() は削除
|
| 5 |
+
try:
|
| 6 |
+
demo = gr.load(name="lxcorp/Link1-270M-Q8_0-GGUF", src=transformers_gradio.registry)
|
| 7 |
+
except Exception as e:
|
| 8 |
+
print(f"Loading error: {e}")
|
| 9 |
+
# ロードに失敗しても、llama.cppサーバーが裏で動く
|
| 10 |
+
demo = gr.Interface(fn=lambda x: f"Loading: {e}", inputs="text", outputs="text")
|
| 11 |
+
|
| 12 |
+
# API名を隠す
|
| 13 |
+
for fn in demo.fns.values():
|
| 14 |
+
fn.api_name = False
|
| 15 |
+
|
| 16 |
+
if __name__ == "__main__":
|
| 17 |
+
demo.launch()
|