Spaces:
Running
Running
Update witness/witness_rzero.py
Browse files- witness/witness_rzero.py +9 -3
witness/witness_rzero.py
CHANGED
|
@@ -23,11 +23,17 @@ def query_rzero_with_witness(user_input: str) -> str:
|
|
| 23 |
# New class wrapper for app.py usage
|
| 24 |
# -------------------------
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
class WitnessRZero:
|
| 27 |
-
def __init__(self, device="cpu", model_id="
|
| 28 |
self.device = device
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def generate(self, user_input: str, **kwargs) -> str:
|
| 33 |
full_prompt = f"{ABRAHAMIC_SYSTEM_PROMPT}\n\nUser: {user_input}"
|
|
|
|
| 23 |
# New class wrapper for app.py usage
|
| 24 |
# -------------------------
|
| 25 |
|
| 26 |
+
import os
|
| 27 |
+
from huggingface_hub import InferenceClient
|
| 28 |
+
from witness.witness_protocol import ABRAHAMIC_SYSTEM_PROMPT, witness_review
|
| 29 |
+
|
| 30 |
class WitnessRZero:
|
| 31 |
+
def __init__(self, device="cpu", model_id="your-featherless-ai-model-id"):
|
| 32 |
self.device = device
|
| 33 |
+
self.client = InferenceClient(
|
| 34 |
+
model_id,
|
| 35 |
+
token=os.getenv("HUGGINGFACEHUB_API_TOKEN") # must match repo secret name
|
| 36 |
+
)
|
| 37 |
|
| 38 |
def generate(self, user_input: str, **kwargs) -> str:
|
| 39 |
full_prompt = f"{ABRAHAMIC_SYSTEM_PROMPT}\n\nUser: {user_input}"
|