bug fixes
Browse files- app.py +4 -4
- dataloader.py +1 -1
- model_dd.py +1 -1
app.py
CHANGED
|
@@ -37,16 +37,16 @@ with gr.Blocks() as demo:
|
|
| 37 |
lines=5,
|
| 38 |
label="Input",
|
| 39 |
type='text',
|
| 40 |
-
|
| 41 |
-
|
| 42 |
)
|
| 43 |
|
| 44 |
output_txt = gr.Textbox(
|
| 45 |
lines=5,
|
| 46 |
label="Output",
|
| 47 |
type='text',
|
| 48 |
-
|
| 49 |
-
|
| 50 |
)
|
| 51 |
|
| 52 |
btn = gr.Button(value="Shakkel")
|
|
|
|
| 37 |
lines=5,
|
| 38 |
label="Input",
|
| 39 |
type='text',
|
| 40 |
+
rtl=True,
|
| 41 |
+
text_align='right',
|
| 42 |
)
|
| 43 |
|
| 44 |
output_txt = gr.Textbox(
|
| 45 |
lines=5,
|
| 46 |
label="Output",
|
| 47 |
type='text',
|
| 48 |
+
rtl=True,
|
| 49 |
+
text_align='right',
|
| 50 |
)
|
| 51 |
|
| 52 |
btn = gr.Button(value="Shakkel")
|
dataloader.py
CHANGED
|
@@ -24,7 +24,7 @@ class DataRetriever(Dataset):
|
|
| 24 |
|
| 25 |
def __getitem__(self, idx):
|
| 26 |
word_x, char_x, diac_x, diac_y = self.create_sentence(idx)
|
| 27 |
-
return self.preprocess((word_x, char_x, diac_x)), T.tensor(diac_y, dtype=T.long)
|
| 28 |
|
| 29 |
def create_sentence(self, idx):
|
| 30 |
line = self.lines[idx]
|
|
|
|
| 24 |
|
| 25 |
def __getitem__(self, idx):
|
| 26 |
word_x, char_x, diac_x, diac_y = self.create_sentence(idx)
|
| 27 |
+
return self.preprocess((word_x, char_x, diac_x)), T.tensor(diac_y, dtype=T.long)
|
| 28 |
|
| 29 |
def create_sentence(self, idx):
|
| 30 |
line = self.lines[idx]
|
model_dd.py
CHANGED
|
@@ -179,7 +179,7 @@ class DiacritizerD2(nn.Module):
|
|
| 179 |
for inputs, _ in tqdm(dataloader, total=len(dataloader)):
|
| 180 |
inputs[0] = inputs[0].to(self.device)
|
| 181 |
inputs[1] = inputs[1].to(self.device)
|
| 182 |
-
diac
|
| 183 |
|
| 184 |
output = np.argmax(T.softmax(diac.detach(), dim=-1).cpu().numpy(), axis=-1)
|
| 185 |
#^ [b ts tw]
|
|
|
|
| 179 |
for inputs, _ in tqdm(dataloader, total=len(dataloader)):
|
| 180 |
inputs[0] = inputs[0].to(self.device)
|
| 181 |
inputs[1] = inputs[1].to(self.device)
|
| 182 |
+
diac = self(*inputs)
|
| 183 |
|
| 184 |
output = np.argmax(T.softmax(diac.detach(), dim=-1).cpu().numpy(), axis=-1)
|
| 185 |
#^ [b ts tw]
|