Spaces:
Running
on
Zero
Running
on
Zero
zRzRzRzRzRzRzR
commited on
Commit
·
4fa9584
1
Parent(s):
79d57f6
app.py
CHANGED
@@ -4,7 +4,6 @@ from transformers import AutoProcessor, Glm4vForConditionalGeneration, TextItera
|
|
4 |
from pathlib import Path
|
5 |
import threading
|
6 |
import re
|
7 |
-
import argparse
|
8 |
import copy
|
9 |
import spaces
|
10 |
import fitz
|
@@ -80,7 +79,7 @@ class GLM4VModel:
|
|
80 |
seg = re.search(r"<think>(.*?)</think>", buf, re.DOTALL)
|
81 |
if seg:
|
82 |
think_html = (
|
83 |
-
"<details open><summary style='cursor:pointer;font-weight:bold;color:#bbbbbb;'>💭
|
84 |
"<div style='color:#cccccc;line-height:1.4;padding:10px;border-left:3px solid #666;margin:5px 0;background-color:rgba(128,128,128,0.1);'>"
|
85 |
+ seg.group(1).strip().replace("\n", "<br>")
|
86 |
+ "</div></details>"
|
@@ -88,7 +87,7 @@ class GLM4VModel:
|
|
88 |
else:
|
89 |
part = buf.split("<think>", 1)[1]
|
90 |
think_html = (
|
91 |
-
"<details open><summary style='cursor:pointer;font-weight:bold;color:#bbbbbb;'>💭
|
92 |
"<div style='color:#cccccc;line-height:1.4;padding:10px;border-left:3px solid #666;margin:5px 0;background-color:rgba(128,128,128,0.1);'>"
|
93 |
+ part.replace("\n", "<br>")
|
94 |
+ "</div></details>"
|
|
|
4 |
from pathlib import Path
|
5 |
import threading
|
6 |
import re
|
|
|
7 |
import copy
|
8 |
import spaces
|
9 |
import fitz
|
|
|
79 |
seg = re.search(r"<think>(.*?)</think>", buf, re.DOTALL)
|
80 |
if seg:
|
81 |
think_html = (
|
82 |
+
"<details open><summary style='cursor:pointer;font-weight:bold;color:#bbbbbb;'>💭 Thinking</summary>"
|
83 |
"<div style='color:#cccccc;line-height:1.4;padding:10px;border-left:3px solid #666;margin:5px 0;background-color:rgba(128,128,128,0.1);'>"
|
84 |
+ seg.group(1).strip().replace("\n", "<br>")
|
85 |
+ "</div></details>"
|
|
|
87 |
else:
|
88 |
part = buf.split("<think>", 1)[1]
|
89 |
think_html = (
|
90 |
+
"<details open><summary style='cursor:pointer;font-weight:bold;color:#bbbbbb;'>💭 Thinking</summary>"
|
91 |
"<div style='color:#cccccc;line-height:1.4;padding:10px;border-left:3px solid #666;margin:5px 0;background-color:rgba(128,128,128,0.1);'>"
|
92 |
+ part.replace("\n", "<br>")
|
93 |
+ "</div></details>"
|