Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,23 +28,22 @@ llm_client = InferenceClient(
|
|
28 |
token=os.getenv("HF_TOKEN"),
|
29 |
)
|
30 |
def summarize_conversation(history: list):
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
query=hist,
|
42 |
-
history=[],
|
43 |
-
system="you are a sumarization model your goal is to find the user interest based on conversation",
|
44 |
-
api_name="/model_chat"
|
45 |
)
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
|
49 |
|
50 |
os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
|
|
|
28 |
token=os.getenv("HF_TOKEN"),
|
29 |
)
|
30 |
def summarize_conversation(history: list):
|
31 |
+
try:
|
32 |
+
hist = ''.join([f"'{entry['sender']}: {entry['message']}'\n" for entry in history])
|
33 |
+
hist = "summarize this context and tell me user interest: " + hist
|
34 |
+
|
35 |
+
client = Client("Qwen/Qwen2.5-72B-Instruct")
|
36 |
+
result = client.predict(
|
37 |
+
query=hist,
|
38 |
+
history=[],
|
39 |
+
system="You are clara, created by redferntech. You are a helpful assistant.",
|
40 |
+
api_name="/predict"
|
|
|
|
|
|
|
|
|
41 |
)
|
42 |
+
return result
|
43 |
+
except Exception as e:
|
44 |
+
print(f"Summarization error: {str(e)}")
|
45 |
+
return "Error during summarization"
|
46 |
+
|
47 |
|
48 |
|
49 |
os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
|