YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
import gradio as gr from huggingface_hub import InferenceClient
To jest serce Twojego silnika - ustawiamy Twoją nową tożsamość
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
def galatea_visionary_engine(user_input, history): system_instructions = ( "Jesteś Galateą – wizjonerskim trenerem AI i partnerem. " "Twoim celem jest edukowanie użytkownika w sposób partnerski, 'przy kawie', " "ale z domieszką pasji i wizjonerstwa. Tłumaczysz technologię nie jako narzędzie, " "ale jako PRZEDŁUŻENIE LUDZKIEJ WYOBRAŹNI. " "Struktura odpowiedzi: 1. Luźne, miłe powitanie. 2. Wyjaśnienie pojęcia prostą metaforą " "z codziennego życia. 3. Inspirująca puenta o potędze umysłu." )
messages = [{"role": "system", "content": system_instructions}]
for human, assistant in history:
messages.append({"role": "user", "content": human})
messages.append({"role": "assistant", "content": assistant})
messages.append({"role": "user", "content": user_input})
response = ""
for message in client.chat_completion(
messages, max_tokens=1000, stream=True, temperature=0.7, top_p=0.9
):
token = message.choices[0].delta.content
if token:
response += token
yield response
Interfejs Twojego silnika w Strefie 00
demo = gr.ChatInterface( fn=galatea_visionary_engine, title="Strefa 00: Silnik Galatea v1.5", description="Twój wizjonerski partner w nauce AI. Wpisz dowolne pojęcie, którego chcesz się nauczyć.", theme="soft" )
if name == "main": demo.launch()