Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,15 +54,11 @@ def evaluate_prompt(user_prompt):
|
|
| 54 |
}
|
| 55 |
response = requests.post(HF_API_URL, headers=HEADERS, json=payload)
|
| 56 |
if response.status_code == 200:
|
| 57 |
-
return
|
| 58 |
else:
|
| 59 |
return f"Error: {response.status_code} - {response.text}"
|
| 60 |
|
| 61 |
-
|
| 62 |
-
def clean_response(text):
|
| 63 |
-
match = re.search(r"(?=Evaluation:)", text, re.IGNORECASE)
|
| 64 |
-
return text[match.start():] if match else text
|
| 65 |
-
|
| 66 |
# App UI
|
| 67 |
st.set_page_config("PromptPolice", page_icon="🚓", layout="centered")
|
| 68 |
st.markdown("""
|
|
|
|
| 54 |
}
|
| 55 |
response = requests.post(HF_API_URL, headers=HEADERS, json=payload)
|
| 56 |
if response.status_code == 200:
|
| 57 |
+
return response.json()["choices"][0]["message"]["content"]
|
| 58 |
else:
|
| 59 |
return f"Error: {response.status_code} - {response.text}"
|
| 60 |
|
| 61 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# App UI
|
| 63 |
st.set_page_config("PromptPolice", page_icon="🚓", layout="centered")
|
| 64 |
st.markdown("""
|