neelimapreeti297 commited on
Commit
a8092e0
·
verified ·
1 Parent(s): 894cd11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,24 +1,22 @@
1
  import gradio as gr
2
  import torch
3
 
4
- from ipynb.fs.defs.germanToEnglish import Seq2SeqTransformer, translate
5
 
6
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
7
  model = model.load_state_dict(torch.load('./transformer_model.pth', map_location=device))
8
  model.eval()
9
 
10
  if __name__ == "__main__":
11
- # Create the Gradio interface
12
  iface = gr.Interface(
13
- fn=translate, # Specify the translation function as the main function
14
  inputs=[
15
- gr.inputs.Textbox(label="Text")
16
 
17
  ],
18
- outputs=["text"], # Define the output type as text
19
- cache_examples=False, # Disable caching of examples
20
- title="germanToenglish", # Set the title of the interface
21
  )
22
 
23
- # Launch the interface
24
  iface.launch(share=True)
 
1
  import gradio as gr
2
  import torch
3
 
4
+ from germantoenglish import Seq2SeqTransformer, translate, greedy_decode
5
 
6
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
7
  model = model.load_state_dict(torch.load('./transformer_model.pth', map_location=device))
8
  model.eval()
9
 
10
  if __name__ == "__main__":
 
11
  iface = gr.Interface(
12
+ fn=translate,
13
  inputs=[
14
+ gr.components.Textbox(label="Text")
15
 
16
  ],
17
+ outputs=["text"],
18
+ cache_examples=False,
19
+ title="GermanToEnglish",
20
  )
21
 
 
22
  iface.launch(share=True)