thewh1teagle commited on
Commit
ef61852
·
verified ·
1 Parent(s): 958b7d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -10
app.py CHANGED
@@ -3,16 +3,36 @@ from dicta_onnx import Dicta
3
 
4
  dicta = Dicta('./dicta-1.0.int8.onnx')
5
 
6
- def add_diacritics(text):
 
 
7
  return dicta.add_diacritics(text)
8
 
9
- iface = gr.Interface(
10
- fn=add_diacritics,
11
- inputs=gr.Textbox(placeholder='Type text without diacritics', lines=3, rtl=True),
12
- outputs=gr.Textbox(label='Text with diacritics', rtl=True),
13
- title='Add diacritics to Hebrew text',
14
- description='Type and press the button to add diacritics.',
15
- live=False,
16
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- iface.launch()
 
 
3
 
4
  dicta = Dicta('./dicta-1.0.int8.onnx')
5
 
6
+ theme = gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto")])
7
+
8
+ def add_diacritics(text: str) -> str:
9
  return dicta.add_diacritics(text)
10
 
11
+ with gr.Blocks(theme=theme) as demo:
12
+ gr.Markdown("# Hebrew Text Diacritization")
13
+ gr.Markdown("Enter Hebrew text without diacritics, and the model will add them.")
14
+
15
+ text_input = gr.Textbox(
16
+ placeholder="Type text without diacritics...",
17
+ label="Input Text",
18
+ lines=5,
19
+ rtl=True,
20
+ elem_classes=["input"]
21
+ )
22
+ diacritized_output = gr.Textbox(
23
+ label="Text with Diacritics",
24
+ lines=7,
25
+ rtl=True,
26
+ elem_classes=["output"]
27
+ )
28
+
29
+ submit_button = gr.Button("Add Diacritics")
30
+
31
+ submit_button.click(
32
+ fn=add_diacritics,
33
+ inputs=[text_input],
34
+ outputs=[diacritized_output]
35
+ )
36
 
37
+ if __name__ == "__main__":
38
+ demo.launch()