Spaces:
Runtime error
Runtime error
update emoji
Browse files
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
|
|
|
|
| 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 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
| 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():
|