Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ try:
|
|
| 8 |
from llama_cpp import Llama
|
| 9 |
except ImportError:
|
| 10 |
print("Installing pre-built llama-cpp-python wheel...")
|
| 11 |
-
|
| 12 |
wheel_url = "https://abetlen.github.io/llama-cpp-python/wheels/cpu"
|
| 13 |
|
| 14 |
subprocess.check_call([
|
|
@@ -25,7 +24,7 @@ from fastapi.responses import JSONResponse, StreamingResponse
|
|
| 25 |
import gradio as gr
|
| 26 |
from huggingface_hub import hf_hub_download
|
| 27 |
|
| 28 |
-
#
|
| 29 |
MODEL_REPO = "lukey03/Qwen3.5-9B-abliterated-GGUF"
|
| 30 |
MODEL_FILE = "Qwen3.5-9B-abliterated-Q4_K_M.gguf"
|
| 31 |
|
|
@@ -43,7 +42,7 @@ llm = Llama(
|
|
| 43 |
|
| 44 |
app = FastAPI()
|
| 45 |
|
| 46 |
-
# OpenAI
|
| 47 |
@app.post("/v1/chat/completions")
|
| 48 |
async def chat_completions(request: Request):
|
| 49 |
try:
|
|
@@ -104,7 +103,6 @@ def generate_code(message, history):
|
|
| 104 |
)
|
| 105 |
return response['choices'][0]['message']['content']
|
| 106 |
|
| 107 |
-
# Gradio ChatInterface without deprecated 'type' keyword argument
|
| 108 |
demo = gr.ChatInterface(
|
| 109 |
fn=generate_code,
|
| 110 |
title="Qwen 3.5 9B Abliterated - Universal Coding API"
|
|
|
|
| 8 |
from llama_cpp import Llama
|
| 9 |
except ImportError:
|
| 10 |
print("Installing pre-built llama-cpp-python wheel...")
|
|
|
|
| 11 |
wheel_url = "https://abetlen.github.io/llama-cpp-python/wheels/cpu"
|
| 12 |
|
| 13 |
subprocess.check_call([
|
|
|
|
| 24 |
import gradio as gr
|
| 25 |
from huggingface_hub import hf_hub_download
|
| 26 |
|
| 27 |
+
# Model Configuration
|
| 28 |
MODEL_REPO = "lukey03/Qwen3.5-9B-abliterated-GGUF"
|
| 29 |
MODEL_FILE = "Qwen3.5-9B-abliterated-Q4_K_M.gguf"
|
| 30 |
|
|
|
|
| 42 |
|
| 43 |
app = FastAPI()
|
| 44 |
|
| 45 |
+
# OpenAI-Compatible Endpoint
|
| 46 |
@app.post("/v1/chat/completions")
|
| 47 |
async def chat_completions(request: Request):
|
| 48 |
try:
|
|
|
|
| 103 |
)
|
| 104 |
return response['choices'][0]['message']['content']
|
| 105 |
|
|
|
|
| 106 |
demo = gr.ChatInterface(
|
| 107 |
fn=generate_code,
|
| 108 |
title="Qwen 3.5 9B Abliterated - Universal Coding API"
|