Spaces:
Build error
Build error
| import gradio as gr | |
| from llama_cpp import Llama | |
| # Load the Llama model | |
| llm = Llama.from_pretrained( | |
| repo_id="krishna195/second_guff", | |
| filename="unsloth.Q4_K_M.gguf", | |
| ) | |
| # Define the chatbot function | |
| def chatbot_response(user_input): | |
| # System instructions | |
| system_prompt = """ | |
| You are a chatbot specializing in recommending songs by the Estonian folk band **Curly Strings**. | |
| based on this anw the question and give the link of the source | |
| ## 🎵 **Song List** | |
| Here are some songs by Curly Strings: | |
| 1. **Kalakesed** | |
| 2. **Kus mu süda on ...** | |
| 3. **Vitsalaul** | |
| 4. **Viimases jaamas** | |
| 5. **Salaja** | |
| 6. **Üle ilma** | |
| 7. **Šveits** | |
| 8. **Kallimale** | |
| 9. **Üksteist peab hoidma** | |
| 10. **Suuda öelda ei** | |
| 11. **Annan käe** | |
| 12. **Tulbid ja Bonsai** | |
| 13. **Tüdruk Pika Kleidiga** | |
| 14. **Armasta mind (feat. Vaiko Eplik)** | |
| 15. **Minu, Pets, Margus ja Priit** | |
| 16. **Kauges külas** | |
| 17. **Tule ja jää** | |
| 18. **Kuutõbine** | |
| 19. **Omaenese ilus ja veas** | |
| 20. **Pulmad** | |
| 21. **Pillimeeste laul** | |
| 22. **Tehke ruumi!** | |
| ## 🎤 **Related Artists** | |
| If you enjoy Curly Strings, you might also like: | |
| - **Trad.Attack!** | |
| - **Eesti Raadio laululapsed** | |
| - **Körsikud** | |
| - **Karl-Erik Taukar** | |
| - **Dag** | |
| - **Sadamasild** | |
| - **Kruuv** | |
| - **Smilers** | |
| - **Mari Jürjens** | |
| - **Terminaator** | |
| --- | |
| """ | |
| # Generate response from Llama model | |
| response = llm.create_chat_completion( | |
| messages=[ | |
| {"role": "system", "content": system_prompt}, | |
| {"role": "user", "content": user_input} | |
| ], | |
| temperature=0.5, | |
| max_tokens=1000, # Increased for better answers | |
| top_p=0.9, | |
| frequency_penalty=0.8, | |
| ) | |
| return response["choices"][0]["message"]["content"].strip() | |
| # Create Gradio interface | |
| iface = gr.Interface( | |
| fn=chatbot_response, | |
| inputs=gr.Textbox(placeholder="Ask me about Curly Strings..."), | |
| outputs="text", | |
| title="Curly Strings Chatbot 🎵", | |
| description="Ask me about songs, albums, or anything related to Curly Strings!", | |
| theme="compact", | |
| ) | |
| # Launch the Gradio app | |
| iface.launch() |