Spaces:
Running
Running
Commit ·
f74d0ab
1
Parent(s): 981bd19
Set up generation function.
Browse files
app.py
CHANGED
|
@@ -27,6 +27,23 @@ To do
|
|
| 27 |
"""
|
| 28 |
from huggingface_hub import hf_hub_download
|
| 29 |
from llama_cpp import Llama
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
"""
|
| 28 |
from huggingface_hub import hf_hub_download
|
| 29 |
from llama_cpp import Llama
|
| 30 |
+
import gradio as gr
|
| 31 |
+
|
| 32 |
+
# ----- Get Model ----- #
|
| 33 |
+
# Download Q4_K_M GGUF file from the repo
|
| 34 |
+
model_path = hf_hub_download(
|
| 35 |
+
repo_id="Qwen/Qwen2.5-Coder-7B-Instruct-GGUF",
|
| 36 |
+
filename="qwen2.5-coder-7b-instruct-q4_k_m.gguf"
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
# Initialize llama.cpp with the local cached path
|
| 40 |
+
llm = Llama(
|
| 41 |
+
model_path=model_path,
|
| 42 |
+
n_ctx=2048,
|
| 43 |
+
n_threads=2
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
# ----- Generation function ----- #
|
| 47 |
+
def generate_flowchart(src_code: str):
|
| 48 |
+
# use llm.create_chat_completion
|
| 49 |
+
pass
|