Update space
Browse files- app.py +6 -9
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"""
|
| 7 |
-
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
| 9 |
|
| 10 |
def respond(
|
|
@@ -27,6 +25,7 @@ def respond(
|
|
| 27 |
|
| 28 |
response = ""
|
| 29 |
|
|
|
|
| 30 |
for message in client.chat_completion(
|
| 31 |
messages,
|
| 32 |
max_tokens=max_tokens,
|
|
@@ -39,9 +38,8 @@ def respond(
|
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
"""
|
| 45 |
demo = gr.ChatInterface(
|
| 46 |
respond,
|
| 47 |
additional_inputs=[
|
|
@@ -58,6 +56,5 @@ demo = gr.ChatInterface(
|
|
| 58 |
],
|
| 59 |
)
|
| 60 |
|
| 61 |
-
|
| 62 |
if __name__ == "__main__":
|
| 63 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
# Настраиваем клиента для работы с моделью lmms-lab/llama3-llava-next-8b
|
| 5 |
+
client = InferenceClient("lmms-lab/llama3-llava-next-8b")
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
def respond(
|
|
|
|
| 25 |
|
| 26 |
response = ""
|
| 27 |
|
| 28 |
+
# Используем модель lmms-lab/llama3-llava-next-8b для генерации ответа
|
| 29 |
for message in client.chat_completion(
|
| 30 |
messages,
|
| 31 |
max_tokens=max_tokens,
|
|
|
|
| 38 |
response += token
|
| 39 |
yield response
|
| 40 |
|
| 41 |
+
|
| 42 |
+
# Создаем интерфейс Gradio с использованием модели lmms-lab/llama3-llava-next-8b
|
|
|
|
| 43 |
demo = gr.ChatInterface(
|
| 44 |
respond,
|
| 45 |
additional_inputs=[
|
|
|
|
| 56 |
],
|
| 57 |
)
|
| 58 |
|
|
|
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
huggingface_hub==0.22.2
|
|
|
|
|
|
| 1 |
+
huggingface_hub==0.22.2
|
| 2 |
+
gradio
|