Spaces:
Build error
Build error
app.py
CHANGED
|
@@ -85,16 +85,13 @@ def compute_similarity(text1, text2):
|
|
| 85 |
def query_zephyr_model(text1, text2, question):
|
| 86 |
prompt = f"Compare the following two contracts and answer the question:\nText 1: {text1}\nText 2: {text2}\nQuestion: {question}"
|
| 87 |
try:
|
| 88 |
-
result = inference_client(
|
| 89 |
-
|
| 90 |
-
return result['generated_text']
|
| 91 |
-
else:
|
| 92 |
-
st.error("No generated text found in the response.")
|
| 93 |
-
return None
|
| 94 |
except Exception as e:
|
| 95 |
st.error(f"Error querying the model: {e}")
|
| 96 |
return None
|
| 97 |
|
|
|
|
| 98 |
# ========== MAIN ==========
|
| 99 |
def main():
|
| 100 |
st.title("📑 Contract Analyzer")
|
|
|
|
| 85 |
def query_zephyr_model(text1, text2, question):
|
| 86 |
prompt = f"Compare the following two contracts and answer the question:\nText 1: {text1}\nText 2: {text2}\nQuestion: {question}"
|
| 87 |
try:
|
| 88 |
+
result = inference_client.text_generation(prompt)
|
| 89 |
+
return result.generated_text
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
except Exception as e:
|
| 91 |
st.error(f"Error querying the model: {e}")
|
| 92 |
return None
|
| 93 |
|
| 94 |
+
|
| 95 |
# ========== MAIN ==========
|
| 96 |
def main():
|
| 97 |
st.title("📑 Contract Analyzer")
|