reshinthadithyan commited on
Commit
ab3f69e
1 Parent(s): 2da0be7

adding basic model addition

Browse files
Files changed (1) hide show
  1. main.py +36 -0
main.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
3
+
4
+
5
+ MODEL_NAME = "reshinthadith"
6
+ def load_model_and_tokenizer(model_name):
7
+ """Adding load_model_and_tokenizer function to keep the model in the memory"""
8
+ model = AutoModelForCausalLM.from_pretrained(model_name)
9
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
10
+ return tokenizer,model
11
+
12
+ tokenizer,model = load_model_and_tokenizer(MODEL_NAME)
13
+
14
+ st.set_page_config(
15
+ page_title= "Code Representation Learning",
16
+ initial_sidebar_state= "expanded"
17
+ )
18
+ st.sidebar.title("Code Representation Learning")
19
+ workflow = st.sidebar.selectbox('select a task', ['Bash Synthesis'])
20
+ if workflow == "Bash Synthesis":
21
+ st.title("Program Synthesis for Bash")
22
+ arxiv_id = st.text_input("Natural Language prompt ","list all the files in the directory 'data\' ")
23
+ output_diction = {}
24
+ button = st.button("synthesize")
25
+ if button:
26
+ link_gen = r"https://arxiv.org/abs/"
27
+ webbrowser.open_new_tab(link_gen+str(arxiv_id))
28
+ # Abstract
29
+ with st.beta_expander("Abstract"):
30
+ st.write(output_diction["abstract"])
31
+ with st.beta_expander("Influencing Citations"):
32
+ st.write(output_diction["influenital_citations"])
33
+ with st.beta_expander("Citation Graph"):
34
+ print("")
35
+ elif workflow == "Rebuttal Analysis":
36
+ st.title("Rebuttal Analysis")