Spaces:
Sleeping
Sleeping
Commit
·
3eaa8aa
1
Parent(s):
f08ec97
Updated
Browse files
app.py
CHANGED
|
@@ -130,13 +130,16 @@ market_llm = HuggingFaceEndpoint(
|
|
| 130 |
# ==============================
|
| 131 |
def run_conversational_model(model, prompt: str):
|
| 132 |
"""Wraps prompt into HF conversational format and extracts text"""
|
| 133 |
-
|
| 134 |
"inputs": {
|
| 135 |
"past_user_inputs": [],
|
| 136 |
"generated_responses": [],
|
| 137 |
"text": prompt
|
| 138 |
}
|
| 139 |
-
}
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
if isinstance(result, dict) and "generated_text" in result:
|
| 142 |
return result["generated_text"]
|
|
@@ -146,6 +149,7 @@ def run_conversational_model(model, prompt: str):
|
|
| 146 |
|
| 147 |
return str(result) # fallback
|
| 148 |
|
|
|
|
| 149 |
# ==============================
|
| 150 |
# ENDPOINTS
|
| 151 |
# ==============================
|
|
|
|
| 130 |
# ==============================
|
| 131 |
def run_conversational_model(model, prompt: str):
|
| 132 |
"""Wraps prompt into HF conversational format and extracts text"""
|
| 133 |
+
payload = {
|
| 134 |
"inputs": {
|
| 135 |
"past_user_inputs": [],
|
| 136 |
"generated_responses": [],
|
| 137 |
"text": prompt
|
| 138 |
}
|
| 139 |
+
}
|
| 140 |
+
logger.info(f"Sending to HF model: {payload}")
|
| 141 |
+
result = model.invoke(payload)
|
| 142 |
+
logger.info(f"HF raw response: {result}")
|
| 143 |
|
| 144 |
if isinstance(result, dict) and "generated_text" in result:
|
| 145 |
return result["generated_text"]
|
|
|
|
| 149 |
|
| 150 |
return str(result) # fallback
|
| 151 |
|
| 152 |
+
|
| 153 |
# ==============================
|
| 154 |
# ENDPOINTS
|
| 155 |
# ==============================
|