Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -41,15 +41,22 @@ def provide_advice(table_data: pd.DataFrame, hs_code: str, year: str, month: str
|
|
41 |
f"{table_str}\n\n"
|
42 |
"لطفاً بر اساس این اطلاعات دو پاراگراف مشاوره تخصصی بنویسید."
|
43 |
)
|
|
|
|
|
44 |
try:
|
|
|
45 |
outputs = client.text_generation(
|
46 |
prompt=prompt,
|
47 |
-
model="
|
48 |
max_new_tokens=256
|
49 |
)
|
|
|
|
|
50 |
return outputs
|
51 |
except Exception as e:
|
52 |
-
|
|
|
|
|
53 |
|
54 |
current_year = pd.Timestamp.now().year
|
55 |
years = [str(y) for y in range(2000, current_year+1)]
|
|
|
41 |
f"{table_str}\n\n"
|
42 |
"لطفاً بر اساس این اطلاعات دو پاراگراف مشاوره تخصصی بنویسید."
|
43 |
)
|
44 |
+
print("پرامپت ساختهشده:")
|
45 |
+
print(prompt)
|
46 |
try:
|
47 |
+
print("در حال فراخوانی مدل mistralai/Mixtral-8x7B-Instruct-v0.1...")
|
48 |
outputs = client.text_generation(
|
49 |
prompt=prompt,
|
50 |
+
model="mistralai/Mixtral-8x7B-Instruct-v0.1", # مدل جایگزین
|
51 |
max_new_tokens=256
|
52 |
)
|
53 |
+
print("خروجی مدل دریافت شد:")
|
54 |
+
print(outputs)
|
55 |
return outputs
|
56 |
except Exception as e:
|
57 |
+
error_msg = f"خطا در تولید مشاوره: {str(e)}"
|
58 |
+
print(error_msg)
|
59 |
+
return error_msg
|
60 |
|
61 |
current_year = pd.Timestamp.now().year
|
62 |
years = [str(y) for y in range(2000, current_year+1)]
|