Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
@@ -10,7 +13,7 @@ MODEL_URL = "https://huggingface.co/datasets/psy7743/llama3-8b-instruct-Q8_0.ggu
|
|
| 10 |
MODEL_PATH = "llama3-8b-instruct-Q8_0.gguf"
|
| 11 |
|
| 12 |
if not Path(MODEL_PATH).exists():
|
| 13 |
-
print("📥 Downloading LLaMA model
|
| 14 |
response = requests.get(MODEL_URL, stream=True)
|
| 15 |
with open(MODEL_PATH, "wb") as f:
|
| 16 |
for chunk in response.iter_content(chunk_size=8192):
|
|
@@ -19,7 +22,6 @@ if not Path(MODEL_PATH).exists():
|
|
| 19 |
print("✅ Download complete!")
|
| 20 |
|
| 21 |
|
| 22 |
-
|
| 23 |
def respond(
|
| 24 |
message,
|
| 25 |
history: list[tuple[str, str]],
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
+
import os
|
| 4 |
+
import requests
|
| 5 |
+
from pathlib import Path # ✅ Add this line!
|
| 6 |
|
| 7 |
"""
|
| 8 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 13 |
MODEL_PATH = "llama3-8b-instruct-Q8_0.gguf"
|
| 14 |
|
| 15 |
if not Path(MODEL_PATH).exists():
|
| 16 |
+
print("📥 Downloading LLaMA model...")
|
| 17 |
response = requests.get(MODEL_URL, stream=True)
|
| 18 |
with open(MODEL_PATH, "wb") as f:
|
| 19 |
for chunk in response.iter_content(chunk_size=8192):
|
|
|
|
| 22 |
print("✅ Download complete!")
|
| 23 |
|
| 24 |
|
|
|
|
| 25 |
def respond(
|
| 26 |
message,
|
| 27 |
history: list[tuple[str, str]],
|