raja5259 commited on
Commit
e37b309
1 Parent(s): 83ed340

update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -1,3 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  def sentence_builder(new_tokens, ret_seq, txt):
3
  txt_len = len(txt.split())
 
1
+
2
+ import torch
3
+ import RohanGivenCode
4
+ from RohanGivenCode import *
5
+
6
+
7
+ save1_or_load0 = 0 # 1 => Save; 0 => Load
8
+
9
+ device = 'cpu'
10
+ if torch.cuda.is_available():
11
+ device = 'cuda'
12
+ elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
13
+ device = "mps"
14
+ print(f"using device: {device}")
15
+
16
+ # SEED
17
+ torch.manual_seed(1337)
18
+ if torch.cuda.is_available():
19
+ torch.cuda.manual_seed(1337)
20
+
21
+ # STOP
22
+ # num_return_sequences = 5
23
+ # max_length = 30
24
+
25
  import gradio as gr
26
  def sentence_builder(new_tokens, ret_seq, txt):
27
  txt_len = len(txt.split())