Spaces:
Runtime error
Runtime error
Download app.py from LanyB/Meta_llama-test: direct link, hf CLI and curl.
- Browser
- Download file 510 Bytes
-
https://huggingface.co/spaces/LanyB/Meta_llama-test/resolve/main/app.py
- Command line
-
hf download hf://spaces/LanyB/Meta_llama-test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/LanyB/Meta_llama-test/resolve/main/app.py
510 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.2") | |
| with gr.Blocks() as demo: | |
| chatbot = gr.Chatbot() | |
| msg = gr.Textbox() | |
| clear = gr.ClearButton([msg, chatbot]) | |
| def respond(message, chat_history): | |
| bot_message = pipe(message) | |
| chat_history.append((message, bot_message)) | |
| time.sleep(2) | |
| return "", chat_history | |
| msg.submit(respond, [msg, chatbot], [msg, chatbot]) | |
| demo.launch() | |