Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,18 @@ import streamlit as st
|
|
| 2 |
from utils import extract_text, anonymize_text, score_synopsis
|
| 3 |
from llama_cpp import Llama
|
| 4 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
st.set_page_config(page_title="Synopsis Scorer", layout="wide")
|
| 7 |
|
|
@@ -45,10 +57,10 @@ if article_file and synopsis_file:
|
|
| 45 |
|
| 46 |
# LLM feedback
|
| 47 |
try:
|
| 48 |
-
llm = Llama
|
| 49 |
-
|
| 50 |
-
filename="gemma-3-4b-it-q4_0.gguf"
|
| 51 |
)
|
|
|
|
| 52 |
prompt = (
|
| 53 |
"You are an expert writing evaluator. The user has uploaded two text documents: "
|
| 54 |
"1) a short synopsis, and 2) a longer article (source content). "
|
|
|
|
| 2 |
from utils import extract_text, anonymize_text, score_synopsis
|
| 3 |
from llama_cpp import Llama
|
| 4 |
import os
|
| 5 |
+
from huggingface_hub import snapshot_download
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
# Choose a directory to store the model
|
| 9 |
+
model_dir = "./gemma-3-4b-it-qat-q4_0"
|
| 10 |
+
|
| 11 |
+
# Download the GGUF model
|
| 12 |
+
snapshot_download(
|
| 13 |
+
repo_id="google/gemma-3-4b-it-qat-q4_0-gguf",
|
| 14 |
+
local_dir=model_dir,
|
| 15 |
+
local_dir_use_symlinks=False # Ensures real files are written, not symlinks
|
| 16 |
+
)
|
| 17 |
|
| 18 |
st.set_page_config(page_title="Synopsis Scorer", layout="wide")
|
| 19 |
|
|
|
|
| 57 |
|
| 58 |
# LLM feedback
|
| 59 |
try:
|
| 60 |
+
llm = Llama(
|
| 61 |
+
model_path="gemma-3-4b-it-q4_0.gguf"
|
|
|
|
| 62 |
)
|
| 63 |
+
|
| 64 |
prompt = (
|
| 65 |
"You are an expert writing evaluator. The user has uploaded two text documents: "
|
| 66 |
"1) a short synopsis, and 2) a longer article (source content). "
|