Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -60,11 +60,11 @@ def load_dataset(path):
|
|
60 |
return [Example(**json.loads(l)).with_inputs("question") for l in f]
|
61 |
|
62 |
def optimize(train_file, val_file):
|
|
|
63 |
trainset = load_dataset(train_file.name)
|
64 |
valset = load_dataset(val_file.name)
|
65 |
tp = MIPROv2(metric=evaluate.answer_exact_match, auto="light", num_threads=4)
|
66 |
optimized = tp.compile(model, trainset=trainset, valset=valset)
|
67 |
-
global model
|
68 |
model = optimized
|
69 |
return "✅ تم تحسين النموذج!"
|
70 |
|
|
|
60 |
return [Example(**json.loads(l)).with_inputs("question") for l in f]
|
61 |
|
62 |
def optimize(train_file, val_file):
|
63 |
+
global model # 👈 حل الخطأ هنا
|
64 |
trainset = load_dataset(train_file.name)
|
65 |
valset = load_dataset(val_file.name)
|
66 |
tp = MIPROv2(metric=evaluate.answer_exact_match, auto="light", num_threads=4)
|
67 |
optimized = tp.compile(model, trainset=trainset, valset=valset)
|
|
|
68 |
model = optimized
|
69 |
return "✅ تم تحسين النموذج!"
|
70 |
|