Gül Sena Altıntaş
commited on
Commit
·
93f64e6
1
Parent(s):
6c9db61
- Removed header
Browse files- Updated requirements
- app.py +4 -9
- requirements.txt +4 -1
app.py
CHANGED
|
@@ -66,8 +66,6 @@ def parse_dataset(text):
|
|
| 66 |
return [], "Please enter your dataset"
|
| 67 |
|
| 68 |
lines = text.strip().split("\n")
|
| 69 |
-
if len(lines) < 2:
|
| 70 |
-
return [], "Dataset must have at least a header and one question"
|
| 71 |
|
| 72 |
# Skip header and detect delimiter
|
| 73 |
first_data_line = lines[1] if len(lines) > 1 else lines[0]
|
|
@@ -76,7 +74,8 @@ def parse_dataset(text):
|
|
| 76 |
questions = []
|
| 77 |
errors = []
|
| 78 |
|
| 79 |
-
for i, line in enumerate(lines
|
|
|
|
| 80 |
line = line.strip()
|
| 81 |
if not line:
|
| 82 |
continue
|
|
@@ -175,7 +174,6 @@ def load_model_and_tokenizer(model_path, progress_callback=None):
|
|
| 175 |
f"🧠 Loading model weights for {model_path}... (this may take a while)",
|
| 176 |
)
|
| 177 |
|
| 178 |
-
logger.info(os.getcwd())
|
| 179 |
# Load model with appropriate settings
|
| 180 |
model = AutoModelForCausalLM.from_pretrained(
|
| 181 |
model_path,
|
|
@@ -755,7 +753,6 @@ def create_confidence_chart(results):
|
|
| 755 |
|
| 756 |
def generate_compact_summary_markdown(questions, results, summary_stats):
|
| 757 |
"""Generate a compact markdown summary table for copy-pasting"""
|
| 758 |
-
logger.info("compaaact summary")
|
| 759 |
if not summary_stats or not questions or not results:
|
| 760 |
return "No data available for summary"
|
| 761 |
|
|
@@ -828,7 +825,6 @@ def generate_compact_summary_markdown(questions, results, summary_stats):
|
|
| 828 |
lines.append("- ❌ = Incorrect answer")
|
| 829 |
lines.append("- ⚠️ = Error occurred")
|
| 830 |
lines.append("- Numbers in parentheses = Confidence score")
|
| 831 |
-
logger.info("\n".join(lines))
|
| 832 |
return "\n".join(lines)
|
| 833 |
|
| 834 |
|
|
@@ -957,7 +953,7 @@ with gr.Blocks(
|
|
| 957 |
placeholder="""Enter your dataset here...
|
| 958 |
|
| 959 |
Example format:
|
| 960 |
-
Question,Correct Answer,Choice1,Choice2,Choice3
|
| 961 |
What is 2+2?,4,3,2,5
|
| 962 |
What is the capital of France?,Paris,London,Berlin,Paris""",
|
| 963 |
lines=8,
|
|
@@ -966,8 +962,7 @@ What is the capital of France?,Paris,London,Berlin,Paris""",
|
|
| 966 |
|
| 967 |
gr.Markdown("""
|
| 968 |
**Format Requirements**:
|
| 969 |
-
-
|
| 970 |
-
- Each data line: Question, Correct Answer, Choice1, Choice2, Choice3
|
| 971 |
- Use commas or tabs as separators
|
| 972 |
""")
|
| 973 |
|
|
|
|
| 66 |
return [], "Please enter your dataset"
|
| 67 |
|
| 68 |
lines = text.strip().split("\n")
|
|
|
|
|
|
|
| 69 |
|
| 70 |
# Skip header and detect delimiter
|
| 71 |
first_data_line = lines[1] if len(lines) > 1 else lines[0]
|
|
|
|
| 74 |
questions = []
|
| 75 |
errors = []
|
| 76 |
|
| 77 |
+
for i, line in enumerate(lines, 1):
|
| 78 |
+
# for i, line in enumerate(lines[1:], 2): # Start from line 2 (after header)
|
| 79 |
line = line.strip()
|
| 80 |
if not line:
|
| 81 |
continue
|
|
|
|
| 174 |
f"🧠 Loading model weights for {model_path}... (this may take a while)",
|
| 175 |
)
|
| 176 |
|
|
|
|
| 177 |
# Load model with appropriate settings
|
| 178 |
model = AutoModelForCausalLM.from_pretrained(
|
| 179 |
model_path,
|
|
|
|
| 753 |
|
| 754 |
def generate_compact_summary_markdown(questions, results, summary_stats):
|
| 755 |
"""Generate a compact markdown summary table for copy-pasting"""
|
|
|
|
| 756 |
if not summary_stats or not questions or not results:
|
| 757 |
return "No data available for summary"
|
| 758 |
|
|
|
|
| 825 |
lines.append("- ❌ = Incorrect answer")
|
| 826 |
lines.append("- ⚠️ = Error occurred")
|
| 827 |
lines.append("- Numbers in parentheses = Confidence score")
|
|
|
|
| 828 |
return "\n".join(lines)
|
| 829 |
|
| 830 |
|
|
|
|
| 953 |
placeholder="""Enter your dataset here...
|
| 954 |
|
| 955 |
Example format:
|
| 956 |
+
(Question,Correct Answer,Choice1,Choice2,Choice3)
|
| 957 |
What is 2+2?,4,3,2,5
|
| 958 |
What is the capital of France?,Paris,London,Berlin,Paris""",
|
| 959 |
lines=8,
|
|
|
|
| 962 |
|
| 963 |
gr.Markdown("""
|
| 964 |
**Format Requirements**:
|
| 965 |
+
- Each data line: Question, Correct Answer, Choice1, Choice2, Choice3 (No header)
|
|
|
|
| 966 |
- Use commas or tabs as separators
|
| 967 |
""")
|
| 968 |
|
requirements.txt
CHANGED
|
@@ -3,4 +3,7 @@ tiktoken
|
|
| 3 |
transformers
|
| 4 |
torch
|
| 5 |
pandas
|
| 6 |
-
plotly
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
transformers
|
| 4 |
torch
|
| 5 |
pandas
|
| 6 |
+
plotly
|
| 7 |
+
huggingface-hub
|
| 8 |
+
psutil
|
| 9 |
+
accelerate
|