Spaces:
Runtime error
Runtime error
Commit
·
7438e40
1
Parent(s):
4ebd536
Added variables
Browse files
app.py
CHANGED
|
@@ -1,12 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
| 3 |
from run_llm import template_all, prompt2_pos, prompt2_chunk, prompt2_parse, demon_pos, demon_chunk, demon_parse, model_mapping
|
|
|
|
| 4 |
|
| 5 |
# Your existing code
|
| 6 |
theme = gr.themes.Soft()
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Function to process text based on model and task
|
| 9 |
def process_text(model_name, task, text):
|
|
|
|
| 10 |
# Define prompts for each strategy based on the task
|
| 11 |
strategy_prompts = {
|
| 12 |
'Strategy 1': template_all.format(text),
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
| 3 |
from run_llm import template_all, prompt2_pos, prompt2_chunk, prompt2_parse, demon_pos, demon_chunk, demon_parse, model_mapping
|
| 4 |
+
from tqdm import tqdm
|
| 5 |
|
| 6 |
# Your existing code
|
| 7 |
theme = gr.themes.Soft()
|
| 8 |
|
| 9 |
+
gid_list = selected_idx[args.start:args.end]
|
| 10 |
+
|
| 11 |
+
ptb = []
|
| 12 |
+
with open('ptb.jsonl', 'r') as f:
|
| 13 |
+
for l in f:
|
| 14 |
+
ptb.append(json.loads(l))
|
| 15 |
+
|
| 16 |
+
for gid in tqdm(gid_list, desc='Query'):
|
| 17 |
+
text = ptb[gid]['text']
|
| 18 |
+
|
| 19 |
# Function to process text based on model and task
|
| 20 |
def process_text(model_name, task, text):
|
| 21 |
+
|
| 22 |
# Define prompts for each strategy based on the task
|
| 23 |
strategy_prompts = {
|
| 24 |
'Strategy 1': template_all.format(text),
|