Ritori commited on
Commit
511db5e
1 Parent(s): f28aee5

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. baby_llama2.py +8 -1
  2. requirements.txt +1 -0
baby_llama2.py CHANGED
@@ -1,10 +1,17 @@
1
  import os
2
- os.system('pip install translate')
3
  import subprocess
4
  import gradio as gr
5
  from translate import Translator
6
 
 
 
 
 
7
  def generate_text():
 
 
 
 
8
  cmd = ['./run', 'model.bin']
9
  result = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
10
  translator= Translator(from_lang='en', to_lang='zh-cn')
 
1
  import os
 
2
  import subprocess
3
  import gradio as gr
4
  from translate import Translator
5
 
6
+ def compile_c_program():
7
+ compile_command = ["gcc", "-o", "run", "run.c"] # replace "source.c" with your C source file
8
+ subprocess.check_call(compile_command) # this will raise an error if compilation fails
9
+
10
  def generate_text():
11
+ # Make sure the C program is compiled before we try to run it
12
+ if not os.path.exists("run"):
13
+ compile_c_program()
14
+
15
  cmd = ['./run', 'model.bin']
16
  result = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
17
  translator= Translator(from_lang='en', to_lang='zh-cn')
requirements.txt CHANGED
@@ -6,3 +6,4 @@ tiktoken==0.3.3
6
  torch==2.0.1
7
  tqdm==4.64.1
8
  wandb==0.15.5
 
 
6
  torch==2.0.1
7
  tqdm==4.64.1
8
  wandb==0.15.5
9
+ translate==3.6.1