loubnabnl HF staff commited on
Commit
a9e00bb
β€’
1 Parent(s): 72c2877

update emoji

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +13 -10
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: The Stack Bot
3
- emoji: πŸš€
4
  colorFrom: red
5
  colorTo: blue
6
  sdk: streamlit
 
1
  ---
2
  title: The Stack Bot
3
+ emoji: πŸ’¬
4
  colorFrom: red
5
  colorTo: blue
6
  sdk: streamlit
app.py CHANGED
@@ -8,7 +8,7 @@ with open("utils/table_contents.md", "r") as f:
8
 
9
  st.sidebar.markdown(contents)
10
 
11
- st.title("The Stack Bot πŸ€–")
12
 
13
  intro = """
14
  The Stack Bot is a tool to help you get started with tools developed in [BigCode](https://huggingface.co/bigcode),
@@ -38,7 +38,8 @@ def how_to_load(language):
38
  def load_model(values, language):
39
  model = values["model"]
40
  if not model:
41
- text = f"""No model available for {language.capitalize()}. If you trained a model on this language, let us know at contact@bigcode.com to feature your model!\n\
 
42
  You can also train your own model on The Stack using the instructions below πŸš€"""
43
  st.write(text)
44
  if st.button("Fine-tune your own model", key=4):
@@ -65,14 +66,16 @@ def generate_code(
65
  demo, gen_prompt, max_new_tokens=40, temperature=0.2, seed=0
66
  ):
67
  # call space using its API endpoint
68
- #try:
69
- url = (
70
- f"{demo}/run/predict/"
71
- )
72
- r = requests.post(
73
- url=url, json={"data": [gen_prompt, max_new_tokens, temperature, seed]}
74
- )
75
- generated_text = r.json()["data"][0]
 
 
76
  return generated_text
77
 
78
  def init_nested_buttons():
 
8
 
9
  st.sidebar.markdown(contents)
10
 
11
+ st.title("The Stack Bot πŸ’¬")
12
 
13
  intro = """
14
  The Stack Bot is a tool to help you get started with tools developed in [BigCode](https://huggingface.co/bigcode),
 
38
  def load_model(values, language):
39
  model = values["model"]
40
  if not model:
41
+ text = f"""No model available for {language.capitalize()}. If you trained a model on this language, let us know in\
42
+ in the [Community tab](https://huggingface.co/spaces/loubnabnl/the-stack-bot/discussions) to feature your model!\n\
43
  You can also train your own model on The Stack using the instructions below πŸš€"""
44
  st.write(text)
45
  if st.button("Fine-tune your own model", key=4):
 
66
  demo, gen_prompt, max_new_tokens=40, temperature=0.2, seed=0
67
  ):
68
  # call space using its API endpoint
69
+ try:
70
+ url = (
71
+ f"{demo}/run/predict/"
72
+ )
73
+ r = requests.post(
74
+ url=url, json={"data": [gen_prompt, max_new_tokens, temperature, seed]}
75
+ )
76
+ generated_text = r.json()["data"][0]
77
+ except:
78
+ generated_text = ""
79
  return generated_text
80
 
81
  def init_nested_buttons():