feat: add model name dropdown to form
Browse files
app.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
"""
|
| 5 |
-
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
-
"""
|
| 7 |
-
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
-
|
| 9 |
|
| 10 |
def respond(
|
| 11 |
message,
|
|
@@ -14,7 +9,13 @@ def respond(
|
|
| 14 |
max_tokens,
|
| 15 |
temperature,
|
| 16 |
top_p,
|
|
|
|
| 17 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
messages = [{"role": "system", "content": system_message}]
|
| 19 |
|
| 20 |
for val in history:
|
|
@@ -55,9 +56,13 @@ demo = gr.ChatInterface(
|
|
| 55 |
step=0.05,
|
| 56 |
label="Top-p (nucleus sampling)",
|
| 57 |
),
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
|
| 62 |
if __name__ == "__main__":
|
| 63 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def respond(
|
| 6 |
message,
|
|
|
|
| 9 |
max_tokens,
|
| 10 |
temperature,
|
| 11 |
top_p,
|
| 12 |
+
model_name,
|
| 13 |
):
|
| 14 |
+
"""
|
| 15 |
+
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 16 |
+
"""
|
| 17 |
+
client = InferenceClient(model_name)
|
| 18 |
+
|
| 19 |
messages = [{"role": "system", "content": system_message}]
|
| 20 |
|
| 21 |
for val in history:
|
|
|
|
| 56 |
step=0.05,
|
| 57 |
label="Top-p (nucleus sampling)",
|
| 58 |
),
|
| 59 |
+
gr.Dropdown(
|
| 60 |
+
label="Model",
|
| 61 |
+
choices=["HuggingFaceH4/zephyr-7b-beta", "google/flan-t5-xxl"]
|
| 62 |
+
),
|
| 63 |
+
]
|
| 64 |
)
|
| 65 |
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
+
demo.launch()
|