Spaces:
Runtime error
Runtime error
Mark-Lasfar commited on
Commit ·
ffb5dab
1
Parent(s): 2610ff2
Update Model
Browse files- utils/generation.py +14 -13
utils/generation.py
CHANGED
|
@@ -25,10 +25,10 @@ cache = TTLCache(maxsize=int(os.getenv("QUEUE_SIZE", 100)), ttl=600)
|
|
| 25 |
|
| 26 |
# تعريف LATEX_DELIMS
|
| 27 |
LATEX_DELIMS = [
|
| 28 |
-
{"left": "$$", "right": "$$", "display": True},
|
| 29 |
{"left": "$", "right": "$", "display": False},
|
| 30 |
-
{"left": "\
|
| 31 |
-
{"left": "\
|
| 32 |
]
|
| 33 |
|
| 34 |
# إعداد العميل لـ Hugging Face Router API
|
|
@@ -595,16 +595,6 @@ def format_final(analysis_text: str, visible_text: str) -> str:
|
|
| 595 |
f"{response}" if response else "No final response available."
|
| 596 |
)
|
| 597 |
|
| 598 |
-
def make_raw_preview() -> str:
|
| 599 |
-
return (
|
| 600 |
-
"```text
|
| 601 |
-
"Analysis (live):\n"
|
| 602 |
-
f"{raw_analysis}\n\n"
|
| 603 |
-
"Response (draft):\n"
|
| 604 |
-
f"{raw_visible}\n"
|
| 605 |
-
"```"
|
| 606 |
-
)
|
| 607 |
-
|
| 608 |
def generate(message, history, system_prompt, temperature, reasoning_effort, enable_browsing, max_new_tokens, input_type="text", audio_data=None, image_data=None, output_format="text"):
|
| 609 |
if not message.strip() and not audio_data and not image_data:
|
| 610 |
yield "Please enter a prompt or upload a file."
|
|
@@ -691,6 +681,17 @@ def generate(message, history, system_prompt, temperature, reasoning_effort, ena
|
|
| 691 |
raw_started = False
|
| 692 |
last_flush_len = 0
|
| 693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
try:
|
| 695 |
stream = request_generation(
|
| 696 |
api_key=HF_TOKEN,
|
|
|
|
| 25 |
|
| 26 |
# تعريف LATEX_DELIMS
|
| 27 |
LATEX_DELIMS = [
|
| 28 |
+
{"left": "$$ ", "right": " $$", "display": True},
|
| 29 |
{"left": "$", "right": "$", "display": False},
|
| 30 |
+
{"left": "\$$ ", "right": "\ $$", "display": True},
|
| 31 |
+
{"left": "\$$ ", "right": "\ $$", "display": False},
|
| 32 |
]
|
| 33 |
|
| 34 |
# إعداد العميل لـ Hugging Face Router API
|
|
|
|
| 595 |
f"{response}" if response else "No final response available."
|
| 596 |
)
|
| 597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
def generate(message, history, system_prompt, temperature, reasoning_effort, enable_browsing, max_new_tokens, input_type="text", audio_data=None, image_data=None, output_format="text"):
|
| 599 |
if not message.strip() and not audio_data and not image_data:
|
| 600 |
yield "Please enter a prompt or upload a file."
|
|
|
|
| 681 |
raw_started = False
|
| 682 |
last_flush_len = 0
|
| 683 |
|
| 684 |
+
def make_raw_preview() -> str:
|
| 685 |
+
return (
|
| 686 |
+
"""```text
|
| 687 |
+
Analysis (live):
|
| 688 |
+
{raw_analysis}
|
| 689 |
+
|
| 690 |
+
Response (draft):
|
| 691 |
+
{raw_visible}
|
| 692 |
+
```""".format(raw_analysis=raw_analysis, raw_visible=raw_visible)
|
| 693 |
+
)
|
| 694 |
+
|
| 695 |
try:
|
| 696 |
stream = request_generation(
|
| 697 |
api_key=HF_TOKEN,
|