Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,26 +1,30 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
import os
|
| 3 |
import re
|
| 4 |
-
import
|
| 5 |
-
|
| 6 |
-
import warnings
|
| 7 |
import gradio as gr
|
|
|
|
|
|
|
| 8 |
from huggingface_hub import Repository
|
| 9 |
from text_generation import Client
|
| 10 |
-
from share_btn import community_icon_html, loading_icon_html,
|
|
|
|
| 11 |
|
| 12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 13 |
DIALOGUES_DATASET = "ArmelR/gradio_playground_dialogues"
|
| 14 |
|
| 15 |
API_URL_G = "https://api-inference.huggingface.co/models/ArmelR/starcoder-gradio-v0"
|
| 16 |
API_URL_S = "https://api-inference.huggingface.co/models/HuggingFaceH4/starcoderbase-finetuned-oasst1"
|
| 17 |
-
API_URL_B = "
|
| 18 |
|
| 19 |
model2endpoint = {
|
| 20 |
"starChat-alpha": API_URL_S,
|
| 21 |
"starCoder-gradio": API_URL_G,
|
| 22 |
"starChat-beta": API_URL_B
|
| 23 |
}
|
|
|
|
| 24 |
model_names = list(model2endpoint.keys())
|
| 25 |
|
| 26 |
with open("./HHH_prompt_short.txt", "r") as f:
|
|
@@ -37,16 +41,6 @@ FIM_SUFFIX = "<fim_suffix>"
|
|
| 37 |
|
| 38 |
FIM_INDICATOR = "<FILL_HERE>"
|
| 39 |
|
| 40 |
-
|
| 41 |
-
FORMATS = """
|
| 42 |
-
# Chat mode
|
| 43 |
-
Chat mode prepends the custom [TA prompt](https://huggingface.co/spaces/bigcode/chat-playground/blob/main/TA_prompt_v0.txt) or the [HHH prompt](https://gist.github.com/jareddk/2509330f8ef3d787fc5aaac67aab5f11#file-hhh_prompt-txt) from Anthropic to the request which conditions the model to serve as an assistant.
|
| 44 |
-
|
| 45 |
-
⚠️ **Intended Use**: this app and its [supporting model](https://huggingface.co/bigcode) are provided for demonstration purposes; not to serve as replacement for human expertise. For more details on the model's limitations in terms of factuality and biases, see the [model card.](hf.co/bigcode)
|
| 46 |
-
|
| 47 |
-
"""
|
| 48 |
-
|
| 49 |
-
|
| 50 |
theme = gr.themes.Monochrome(
|
| 51 |
primary_hue="indigo",
|
| 52 |
secondary_hue="blue",
|
|
|
|
| 1 |
+
import datetime
|
| 2 |
+
import random
|
| 3 |
import os
|
| 4 |
import re
|
| 5 |
+
from io import StringIO
|
| 6 |
+
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
+
import pandas as pd
|
| 9 |
+
|
| 10 |
from huggingface_hub import Repository
|
| 11 |
from text_generation import Client
|
| 12 |
+
from share_btn import (community_icon_html, loading_icon_html, share_btn_css,
|
| 13 |
+
share_js)
|
| 14 |
|
| 15 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 16 |
DIALOGUES_DATASET = "ArmelR/gradio_playground_dialogues"
|
| 17 |
|
| 18 |
API_URL_G = "https://api-inference.huggingface.co/models/ArmelR/starcoder-gradio-v0"
|
| 19 |
API_URL_S = "https://api-inference.huggingface.co/models/HuggingFaceH4/starcoderbase-finetuned-oasst1"
|
| 20 |
+
API_URL_B = "https://api-inference.huggingface.co/models/HuggingFaceH4/starchat-beta"
|
| 21 |
|
| 22 |
model2endpoint = {
|
| 23 |
"starChat-alpha": API_URL_S,
|
| 24 |
"starCoder-gradio": API_URL_G,
|
| 25 |
"starChat-beta": API_URL_B
|
| 26 |
}
|
| 27 |
+
|
| 28 |
model_names = list(model2endpoint.keys())
|
| 29 |
|
| 30 |
with open("./HHH_prompt_short.txt", "r") as f:
|
|
|
|
| 41 |
|
| 42 |
FIM_INDICATOR = "<FILL_HERE>"
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
theme = gr.themes.Monochrome(
|
| 45 |
primary_hue="indigo",
|
| 46 |
secondary_hue="blue",
|