Spaces:
Runtime error
Runtime error
zR
commited on
Commit
Β·
bb65500
1
Parent(s):
5cecc58
infer code
Browse files
app.py
CHANGED
@@ -146,18 +146,21 @@ def render_context(file):
|
|
146 |
|
147 |
|
148 |
@spaces.GPU(duration=120)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
def run_llm(context, query):
|
150 |
if not context:
|
151 |
raise gr.Error("Error: no uploaded document")
|
152 |
if not query:
|
153 |
raise gr.Error("Error: no query")
|
154 |
-
result =
|
155 |
-
context,
|
156 |
-
query,
|
157 |
-
tokenizer=tokenizer,
|
158 |
-
max_input_length=128000,
|
159 |
-
max_new_tokens=1024,
|
160 |
-
)
|
161 |
all_statements = result["all_statements"]
|
162 |
answer_html, all_cite_html, clicked_cite_html, cite_num2idx_dict = convert_to_html(
|
163 |
all_statements
|
|
|
146 |
|
147 |
|
148 |
@spaces.GPU(duration=120)
|
149 |
+
def infer(context, query):
|
150 |
+
return model.query_longcite(
|
151 |
+
context=context,
|
152 |
+
query=query,
|
153 |
+
tokenizer=tokenizer,
|
154 |
+
max_input_length=128000,
|
155 |
+
max_new_tokens=1024,
|
156 |
+
)
|
157 |
+
|
158 |
def run_llm(context, query):
|
159 |
if not context:
|
160 |
raise gr.Error("Error: no uploaded document")
|
161 |
if not query:
|
162 |
raise gr.Error("Error: no query")
|
163 |
+
result = infer(context=context, query=query)
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
all_statements = result["all_statements"]
|
165 |
answer_html, all_cite_html, clicked_cite_html, cite_num2idx_dict = convert_to_html(
|
166 |
all_statements
|