File size: 1,272 Bytes
035004c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0abb9f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

# Install the Hugging Face CLI
powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"

# (optional) Login with your Hugging Face credentials
hf auth login

# Push your model files
hf upload RAAZIM/RT-AI . 





import gradio as gr
from transformers import pipeline

# 1. Load the GPT-Neo model (free to use)
generator = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B")

# 2. Create multi-turn chat memory
history = []

def chat(input_text):
    global history
    # Add user input to history
    history.append(f"User: {input_text}")
    # Prepare prompt with conversation history
    prompt = "\n".join(history) + "\nAI:"
    # Generate response
    response = generator(prompt, max_length=200, do_sample=True, temperature=0.7)
    ai_text = response[0]["generated_text"]
    # Add AI response to history
    history.append(f"AI: {ai_text}")
    return ai_text

# 3. Gradio interface
iface = gr.Interface(
    fn=chat,
    inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
    outputs="text",
    title="AltisBot",  # <-- Your chatbot name here
    description="Your free AI assistant chatbot"
)

# 4. Launch the interface
iface.launch()
unknown model type (must be text-to-speech or automatic-speech-recognition)