Upload test.py
Browse files
test.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# pip install -U gradio_client
|
| 2 |
+
from gradio_client import Client
|
| 3 |
+
|
| 4 |
+
client = Client("xy63/test1") # 或 "https://xy63-test1.hf.space"
|
| 5 |
+
|
| 6 |
+
# 1) 直接读取你的 .md 文件
|
| 7 |
+
md_path = r"C:\Users\JACK\Desktop\test\OpenReviewer\paper.md" # 注意用 r"..." 或正斜杠
|
| 8 |
+
paper_text = open(md_path, "r", encoding="utf-8").read()
|
| 9 |
+
|
| 10 |
+
# 2) 可选:做个长度保险(避免再次超时)
|
| 11 |
+
MAX_CHARS = 12000
|
| 12 |
+
paper_text = paper_text[:MAX_CHARS]
|
| 13 |
+
|
| 14 |
+
# 3) 调用 /generate(review_template 可留空用默认模板)
|
| 15 |
+
review_md = client.predict(
|
| 16 |
+
paper_text=paper_text,
|
| 17 |
+
review_template="", # 或自定义一个更短的模板以加速
|
| 18 |
+
api_name="/generate"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
print(review_md)
|