namnh113 commited on
Commit
3376e71
1 Parent(s): e898e1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -18,23 +18,23 @@ class LLM_Langchain():
18
  help="Type in your HuggingFace API key to use this app")
19
 
20
 
21
- model_parent = st.sidebar.selectbox(
22
  label = "Choose language",
23
  options = ["python", "java", "javascript", "php", "ruby", "go", "cpp"],
24
  help="Choose languages",
25
  )
26
 
27
- if model_parent is None:
28
  model_name_visibility = True
29
  else:
30
  model_name_visibility = False
31
 
32
- model_name = return_sum_models(model_parent)
33
  list_model = [model_name]
34
- if model_parent in ["python", "java"]:
35
  list_model += [model_name+"_v2"]
36
- if model_parent != "cpp":
37
- list_model += ["Salesforce/codet5-base-multi-sum", f"Salesforce/codet5-base-codexglue-sum-{model_parent}"]
38
 
39
  self.checkpoint = st.sidebar.selectbox(
40
  label = "Choose model (namnh113/... is my model)",
@@ -92,7 +92,7 @@ class LLM_Langchain():
92
 
93
  def generate_response(self, input_text):
94
 
95
-
96
  llm = HuggingFaceHub(
97
  repo_id = self.checkpoint,
98
  model_kwargs = self.model_kwargs
 
18
  help="Type in your HuggingFace API key to use this app")
19
 
20
 
21
+ self.model_parent = st.sidebar.selectbox(
22
  label = "Choose language",
23
  options = ["python", "java", "javascript", "php", "ruby", "go", "cpp"],
24
  help="Choose languages",
25
  )
26
 
27
+ if self.model_parent is None:
28
  model_name_visibility = True
29
  else:
30
  model_name_visibility = False
31
 
32
+ model_name = return_sum_models(self.model_parent)
33
  list_model = [model_name]
34
+ if self.model_parent in ["python", "java"]:
35
  list_model += [model_name+"_v2"]
36
+ if self.model_parent != "cpp":
37
+ list_model += ["Salesforce/codet5-base-multi-sum", f"Salesforce/codet5-base-codexglue-sum-{self.model_parent}"]
38
 
39
  self.checkpoint = st.sidebar.selectbox(
40
  label = "Choose model (namnh113/... is my model)",
 
92
 
93
  def generate_response(self, input_text):
94
 
95
+ input_text = "Summarize " + self.model_parent.capitalize() + ": " + input_text
96
  llm = HuggingFaceHub(
97
  repo_id = self.checkpoint,
98
  model_kwargs = self.model_kwargs