Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,12 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
|
9 |
USER_NAME = os.environ.get("USER_NAME", None)
|
10 |
APP_PASSWORD = os.environ.get("APP_PASSWORD", None)
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
STOP_SEQUENCES = ["\nUser:", "<|endoftext|>", " User:", "###"]
|
13 |
|
14 |
EXAMPLES = [
|
@@ -67,7 +73,6 @@ def generate(
|
|
67 |
return output
|
68 |
|
69 |
additional_inputs=[
|
70 |
-
gr.Textbox("google/flan-t5-small", label="Input Model Name", type="text", elem_id="model-name-input"),
|
71 |
gr.Textbox("", label="Optional system prompt"),
|
72 |
gr.Slider(
|
73 |
label="Temperature",
|
@@ -132,17 +137,4 @@ with gr.Blocks() as demo:
|
|
132 |
additional_inputs=additional_inputs,
|
133 |
)
|
134 |
|
135 |
-
# Create a function to get the model name from the input
|
136 |
-
def get_model_name():
|
137 |
-
return gr.get_value("model-name-input")
|
138 |
-
|
139 |
-
# Get the model name from the input
|
140 |
-
model_name = get_model_name()
|
141 |
-
|
142 |
-
# Define the model URL using the model_name
|
143 |
-
model_url = 'https://api-inference.huggingface.co/models/' + model_name
|
144 |
-
|
145 |
-
# Create the InferenceClient
|
146 |
-
client = InferenceClient(model_url, headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
147 |
-
|
148 |
demo.queue(concurrency_count=100, api_open=True).launch(show_api=True, auth=(USER_NAME, APP_PASSWORD))
|
|
|
9 |
USER_NAME = os.environ.get("USER_NAME", None)
|
10 |
APP_PASSWORD = os.environ.get("APP_PASSWORD", None)
|
11 |
|
12 |
+
# Define the model URL using the model_name
|
13 |
+
model_url = 'https://api-inference.huggingface.co/models/h2oai/h2ogpt-16k-codellama-34b-instruct'
|
14 |
+
|
15 |
+
# Create the InferenceClient
|
16 |
+
client = InferenceClient(model_url, headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
17 |
+
|
18 |
STOP_SEQUENCES = ["\nUser:", "<|endoftext|>", " User:", "###"]
|
19 |
|
20 |
EXAMPLES = [
|
|
|
73 |
return output
|
74 |
|
75 |
additional_inputs=[
|
|
|
76 |
gr.Textbox("", label="Optional system prompt"),
|
77 |
gr.Slider(
|
78 |
label="Temperature",
|
|
|
137 |
additional_inputs=additional_inputs,
|
138 |
)
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
demo.queue(concurrency_count=100, api_open=True).launch(show_api=True, auth=(USER_NAME, APP_PASSWORD))
|